diff --git a/src/common/io/http/cache.c b/src/common/io/http/cache.c index febd28be2..8472a2f60 100644 --- a/src/common/io/http/cache.c +++ b/src/common/io/http/cache.c @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Client Cache +HTTP Client Cache ***********************************************************************************************************************************/ #include "build.auto.h" @@ -23,7 +23,7 @@ struct HttpClientCache const String *caFile; const String *caPath; - List *clientList; // List of http clients + List *clientList; // List of HTTP clients }; OBJECT_DEFINE_FREE(HTTP_CLIENT_CACHE); diff --git a/src/common/io/http/cache.h b/src/common/io/http/cache.h index 768029914..433a486ac 100644 --- a/src/common/io/http/cache.h +++ b/src/common/io/http/cache.h @@ -1,7 +1,7 @@ /*********************************************************************************************************************************** -Http Client Cache +HTTP Client Cache -Cache http clients and return one that is not busy on request. +Cache HTTP clients and return one that is not busy on request. ***********************************************************************************************************************************/ #ifndef COMMON_IO_HTTP_CLIENT_CACHE_H #define COMMON_IO_HTTP_CLIENT_CACHE_H @@ -25,7 +25,7 @@ HttpClientCache *httpClientCacheNew( /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ -// Get an http client from the cache +// Get an HTTP client from the cache HttpClient *httpClientCacheGet(HttpClientCache *this); /*********************************************************************************************************************************** diff --git a/src/common/io/http/client.c b/src/common/io/http/client.c index 7bc72406d..c452846fb 100644 --- a/src/common/io/http/client.c +++ b/src/common/io/http/client.c @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Client +HTTP Client ***********************************************************************************************************************************/ #include "build.auto.h" @@ -324,17 +324,17 @@ httpClientRequest( // Check status ends with a CR and remove it to make error formatting easier and more accurate if (!strEndsWith(status, CR_STR)) - THROW_FMT(FormatError, "http response status '%s' should be CR-terminated", strPtr(status)); + THROW_FMT(FormatError, "HTTP response status '%s' should be CR-terminated", strPtr(status)); status = strSubN(status, 0, strSize(status) - 1); // Check status is at least the minimum required length to avoid harder to interpret errors later on if (strSize(status) < sizeof(HTTP_VERSION) + 4) - THROW_FMT(FormatError, "http response '%s' has invalid length", strPtr(strTrim(status))); + THROW_FMT(FormatError, "HTTP response '%s' has invalid length", strPtr(strTrim(status))); // Check status starts with the correct http version if (!strBeginsWith(status, HTTP_VERSION_STR)) - THROW_FMT(FormatError, "http version of response '%s' must be " HTTP_VERSION, strPtr(status)); + THROW_FMT(FormatError, "HTTP version of response '%s' must be " HTTP_VERSION, strPtr(status)); // Read status code status = strSub(status, sizeof(HTTP_VERSION)); diff --git a/src/common/io/http/client.h b/src/common/io/http/client.h index 1a6991fe8..3dc5c4b4b 100644 --- a/src/common/io/http/client.h +++ b/src/common/io/http/client.h @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Client +HTTP Client A robust HTTP client with connection reuse and automatic retries. @@ -76,7 +76,7 @@ HttpClient *httpClientNew( /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ -// Is the http object busy? +// Is the HTTP object busy? bool httpClientBusy(const HttpClient *this); // Mark the client as done if read is complete diff --git a/src/common/io/http/common.c b/src/common/io/http/common.c index c40c725ed..b907605b3 100644 --- a/src/common/io/http/common.c +++ b/src/common/io/http/common.c @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Common +HTTP Common ***********************************************************************************************************************************/ #include "build.auto.h" diff --git a/src/common/io/http/common.h b/src/common/io/http/common.h index 131db2003..e4d62266a 100644 --- a/src/common/io/http/common.h +++ b/src/common/io/http/common.h @@ -1,7 +1,5 @@ /*********************************************************************************************************************************** -Http Common - -Http common functions. +HTTP Common ***********************************************************************************************************************************/ #ifndef COMMON_IO_HTTP_COMMON_H #define COMMON_IO_HTTP_COMMON_H diff --git a/src/common/io/http/header.c b/src/common/io/http/header.c index 2a1308f55..5ab967398 100644 --- a/src/common/io/http/header.c +++ b/src/common/io/http/header.c @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Header +HTTP Header ***********************************************************************************************************************************/ #include "build.auto.h" diff --git a/src/common/io/http/header.h b/src/common/io/http/header.h index b32ce5c0b..660f810f2 100644 --- a/src/common/io/http/header.h +++ b/src/common/io/http/header.h @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Header +HTTP Header Object to track HTTP headers. Headers can be marked as redacted so they are not logged. ***********************************************************************************************************************************/ diff --git a/src/common/io/http/query.c b/src/common/io/http/query.c index bb0c26e08..b64627742 100644 --- a/src/common/io/http/query.c +++ b/src/common/io/http/query.c @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Query +HTTP Query ***********************************************************************************************************************************/ #include "build.auto.h" diff --git a/src/common/io/http/query.h b/src/common/io/http/query.h index df8ca63ae..abae0ab8b 100644 --- a/src/common/io/http/query.h +++ b/src/common/io/http/query.h @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Http Query +HTTP Query Object to track HTTP queries and output them with proper escaping. ***********************************************************************************************************************************/ @@ -39,7 +39,7 @@ HttpQuery *httpQueryMove(HttpQuery *this, MemContext *parentNew); //Put a query item HttpQuery *httpQueryPut(HttpQuery *this, const String *header, const String *value); -// Render the query for inclusion in an http request +// Render the query for inclusion in an HTTP request String *httpQueryRender(const HttpQuery *this); /*********************************************************************************************************************************** diff --git a/src/storage/s3/read.c b/src/storage/s3/read.c index ed0f72d4b..588ecbcd3 100644 --- a/src/storage/s3/read.c +++ b/src/storage/s3/read.c @@ -27,7 +27,7 @@ typedef struct StorageReadS3 StorageReadInterface interface; // Interface StorageS3 *storage; // Storage that created this object - HttpClient *httpClient; // Http client for requests + HttpClient *httpClient; // HTTP client for requests } StorageReadS3; /*********************************************************************************************************************************** @@ -39,7 +39,7 @@ Macros for function logging objToLog(value, "StorageReadS3", buffer, bufferSize) /*********************************************************************************************************************************** -Mark http client as done so it can be reused +Mark HTTP client as done so it can be reused ***********************************************************************************************************************************/ OBJECT_DEFINE_FREE_RESOURCE_BEGIN(STORAGE_READ_S3, LOG, logLevelTrace) { diff --git a/src/storage/s3/storage.c b/src/storage/s3/storage.c index b58b7d13f..7520ae9f6 100644 --- a/src/storage/s3/storage.c +++ b/src/storage/s3/storage.c @@ -25,7 +25,7 @@ Storage type STRING_EXTERN(STORAGE_S3_TYPE_STR, STORAGE_S3_TYPE); /*********************************************************************************************************************************** -S3 http headers +S3 HTTP headers ***********************************************************************************************************************************/ STRING_STATIC(S3_HEADER_CONTENT_SHA256_STR, "x-amz-content-sha256"); STRING_STATIC(S3_HEADER_DATE_STR, "x-amz-date"); @@ -86,7 +86,7 @@ struct StorageS3 { STORAGE_COMMON_MEMBER; MemContext *memContext; - HttpClientCache *httpClientCache; // Http client cache to service requests + HttpClientCache *httpClientCache; // HTTP client cache to service requests StringList *headerRedactList; // List of headers to redact from logging const String *bucket; // Bucket to store data in @@ -288,7 +288,7 @@ storageS3Request( this, verb, httpUriEncode(uri, true), query, storageS3DateTime(time(NULL)), requestHeader, body == NULL || bufUsed(body) == 0 ? HASH_TYPE_SHA256_ZERO_STR : bufHex(cryptoHashOne(HASH_TYPE_SHA256_STR, body))); - // Get an http client + // Get an HTTP client HttpClient *httpClient = httpClientCacheGet(this->httpClientCache); // Process request @@ -904,7 +904,7 @@ storageS3New( .signingKeyDate = YYYYMMDD_STR, }; - // Create the http client cache used to service requests + // Create the HTTP client cache used to service requests driver->httpClientCache = httpClientCacheNew( host == NULL ? driver->bucketEndpoint : host, driver->port, timeout, verifyPeer, caFile, caPath); diff --git a/test/src/module/common/ioHttpTest.c b/test/src/module/common/ioHttpTest.c index 792bf6b60..20321b053 100644 --- a/test/src/module/common/ioHttpTest.c +++ b/test/src/module/common/ioHttpTest.c @@ -1,5 +1,5 @@ /*********************************************************************************************************************************** -Test Http +Test HTTP ***********************************************************************************************************************************/ #include @@ -87,7 +87,7 @@ testRun(void) TEST_RESULT_STR_Z( httpHeaderToLog(httpHeaderDup(header, redact)), "{public: , secret: 'secret-value'}", "dup and change redactions"); - TEST_RESULT_PTR(httpHeaderDup(NULL, NULL), NULL, "dup null http header"); + TEST_RESULT_PTR(httpHeaderDup(NULL, NULL), NULL, "dup null header"); } // ***************************************************************************************************************************** @@ -147,10 +147,10 @@ testRun(void) { HARNESS_FORK_CHILD_BEGIN(0, true) { - // Start http test server + // Start HTTP test server TEST_RESULT_VOID( hrnTlsServerRun(ioHandleReadNew(strNew("test server read"), HARNESS_FORK_CHILD_READ(), 5000)), - "http server begin"); + "HTTP server begin"); } HARNESS_FORK_CHILD_END(); @@ -195,7 +195,7 @@ testRun(void) TEST_ERROR( httpClientRequest(client, strNew("GET"), strNew("/"), NULL, NULL, NULL, false), FormatError, - "http response status 'HTTP/1.0 200 OK' should be CR-terminated"); + "HTTP response status 'HTTP/1.0 200 OK' should be CR-terminated"); // ----------------------------------------------------------------------------------------------------------------- TEST_TITLE("status too short"); @@ -209,10 +209,10 @@ testRun(void) TEST_ERROR( httpClientRequest(client, strNew("GET"), strNew("/"), NULL, NULL, NULL, false), FormatError, - "http response 'HTTP/1.0 200' has invalid length"); + "HTTP response 'HTTP/1.0 200' has invalid length"); // ----------------------------------------------------------------------------------------------------------------- - TEST_TITLE("invalid http version"); + TEST_TITLE("invalid HTTP version"); hrnTlsServerAccept(); @@ -223,7 +223,7 @@ testRun(void) TEST_ERROR( httpClientRequest(client, strNew("GET"), strNew("/"), NULL, NULL, NULL, false), FormatError, - "http version of response 'HTTP/1.0 200 OK' must be HTTP/1.1"); + "HTTP version of response 'HTTP/1.0 200 OK' must be HTTP/1.1"); // ----------------------------------------------------------------------------------------------------------------- TEST_TITLE("no space in status"); @@ -535,22 +535,22 @@ testRun(void) HttpClient *client2 = NULL; TEST_ASSIGN( - cache, httpClientCacheNew(strNew("localhost"), hrnTlsServerPort(), 5000, true, NULL, NULL), "new http client cache"); - TEST_ASSIGN(client1, httpClientCacheGet(cache), "get http client"); - TEST_RESULT_PTR(client1, *(HttpClient **)lstGet(cache->clientList, 0), " check http client"); - TEST_RESULT_PTR(httpClientCacheGet(cache), *(HttpClient **)lstGet(cache->clientList, 0), " get same http client"); + cache, httpClientCacheNew(strNew("localhost"), hrnTlsServerPort(), 5000, true, NULL, NULL), "new HTTP client cache"); + TEST_ASSIGN(client1, httpClientCacheGet(cache), "get HTTP client"); + TEST_RESULT_PTR(client1, *(HttpClient **)lstGet(cache->clientList, 0), " check HTTP client"); + TEST_RESULT_PTR(httpClientCacheGet(cache), *(HttpClient **)lstGet(cache->clientList, 0), " get same HTTP client"); // Make client 1 look like it is busy client1->ioRead = (IoRead *)1; - TEST_ASSIGN(client2, httpClientCacheGet(cache), "get http client"); - TEST_RESULT_PTR(client2, *(HttpClient **)lstGet(cache->clientList, 1), " check http client"); + TEST_ASSIGN(client2, httpClientCacheGet(cache), "get HTTP client"); + TEST_RESULT_PTR(client2, *(HttpClient **)lstGet(cache->clientList, 1), " check HTTP client"); TEST_RESULT_BOOL(client1 != client2, true, "clients are not the same"); // Set back to NULL so bad things don't happen during free client1->ioRead = NULL; - TEST_RESULT_VOID(httpClientCacheFree(cache), "free http client cache"); + TEST_RESULT_VOID(httpClientCacheFree(cache), "free HTTP client cache"); } FUNCTION_HARNESS_RESULT_VOID();