1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Rename http/Http to HTTP in comments and messages.

HTTP is an acronym so it should be capitalized. Coding conventions dictate otherwise for function and type names but that should not have been propagated to comments and messages.
This commit is contained in:
David Steele 2020-06-21 11:47:41 -04:00
parent 911384d9b9
commit 1aedc75b03
13 changed files with 39 additions and 41 deletions

View File

@ -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);

View File

@ -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);
/***********************************************************************************************************************************

View File

@ -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));

View File

@ -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

View File

@ -1,5 +1,5 @@
/***********************************************************************************************************************************
Http Common
HTTP Common
***********************************************************************************************************************************/
#include "build.auto.h"

View File

@ -1,7 +1,5 @@
/***********************************************************************************************************************************
Http Common
Http common functions.
HTTP Common
***********************************************************************************************************************************/
#ifndef COMMON_IO_HTTP_COMMON_H
#define COMMON_IO_HTTP_COMMON_H

View File

@ -1,5 +1,5 @@
/***********************************************************************************************************************************
Http Header
HTTP Header
***********************************************************************************************************************************/
#include "build.auto.h"

View File

@ -1,5 +1,5 @@
/***********************************************************************************************************************************
Http Header
HTTP Header
Object to track HTTP headers. Headers can be marked as redacted so they are not logged.
***********************************************************************************************************************************/

View File

@ -1,5 +1,5 @@
/***********************************************************************************************************************************
Http Query
HTTP Query
***********************************************************************************************************************************/
#include "build.auto.h"

View File

@ -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);
/***********************************************************************************************************************************

View File

@ -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)
{

View File

@ -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);

View File

@ -1,5 +1,5 @@
/***********************************************************************************************************************************
Test Http
Test HTTP
***********************************************************************************************************************************/
#include <unistd.h>
@ -87,7 +87,7 @@ testRun(void)
TEST_RESULT_STR_Z(
httpHeaderToLog(httpHeaderDup(header, redact)), "{public: <redacted>, 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();