1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

Add verb to HTTP error output.

This makes it easier to debug HTTP errors.
This commit is contained in:
Christoph Berg 2021-12-08 15:00:19 -05:00 committed by David Steele
parent be4ac3923c
commit c38e2d3170
6 changed files with 26 additions and 16 deletions

View File

@ -98,6 +98,16 @@
<p>Add warning when <pg-setting>checkpoint_timeout</pg-setting> exceeds <br-option>db-timeout</br-option>.</p>
</release-item>
<release-item>
<github-pull-request id="1566"/>
<release-item-contributor-list>
<release-item-contributor id="christoph.berg"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>
<p>Add verb to HTTP error output.</p>
</release-item>
<release-item>
<github-pull-request id="1571"/>
@ -10460,7 +10470,7 @@
<contributor id="christoph.berg">
<contributor-name-display>Christoph Berg</contributor-name-display>
<contributor-id type="github">ChristophBerg</contributor-id>
<contributor-id type="github">df7cb</contributor-id>
</contributor>
<contributor id="christophe.cavallie">

View File

@ -252,7 +252,7 @@ httpRequestError(const HttpRequest *this, HttpResponse *response)
// Output path/query
strCatZ(error, ":\n*** Path/Query ***:");
strCatFmt(error, "\n%s", strZ(httpRequestPath(this)));
strCatFmt(error, "\n%s %s", strZ(httpRequestVerb(this)), strZ(httpRequestPath(this)));
if (httpRequestQuery(this) != NULL)
strCatFmt(error, "?%s", strZ(httpQueryRenderP(httpRequestQuery(this), .redact = true)));

View File

@ -581,7 +581,7 @@ testRun(void)
httpRequestError(request, response), ProtocolError,
"HTTP request failed with 404 (Not Found):\n"
"*** Path/Query ***:\n"
"/");
"GET /");
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("error with content");
@ -612,7 +612,7 @@ testRun(void)
httpRequestError(request, response), ProtocolError,
"HTTP request failed with 403:\n"
"*** Path/Query ***:\n"
"/?a=b\n"
"GET /?a=b\n"
"*** Request Headers ***:\n"
"hdr1: 1\n"
"hdr2: <redacted>\n"

View File

@ -373,7 +373,7 @@ testRun(void)
ioReadOpen(storageReadIo(read)), ProtocolError,
"HTTP request failed with 303:\n"
"*** Path/Query ***:\n"
"/account/container/file.txt\n"
"GET /account/container/file.txt\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 0\n"
@ -396,7 +396,7 @@ testRun(void)
storagePutP(storageNewWriteP(storage, STRDEF("file.txt")), BUFSTRDEF("ABCD")), ProtocolError,
"HTTP request failed with 403 (Forbidden):\n"
"*** Path/Query ***:\n"
"/account/container/file.txt\n"
"PUT /account/container/file.txt\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 4\n"
@ -780,7 +780,7 @@ testRun(void)
storagePathRemoveP(storage, STRDEF("/"), .recurse = true), ProtocolError,
"HTTP request failed with 403 (Forbidden):\n"
"*** Path/Query ***:\n"
"/account/container?comp=list&restype=container&sig=<redacted>\n"
"GET /account/container?comp=list&restype=container&sig=<redacted>\n"
"*** Request Headers ***:\n"
"content-length: 0\n"
"host: %s",

View File

@ -478,7 +478,7 @@ testRun(void)
ioReadOpen(storageReadIo(read)), ProtocolError,
"HTTP request failed with 303:\n"
"*** Path/Query ***:\n"
"/storage/v1/b/bucket/o/file.txt?alt=media\n"
"GET /storage/v1/b/bucket/o/file.txt?alt=media\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 0\n"
@ -501,7 +501,7 @@ testRun(void)
storagePutP(storageNewWriteP(storage, STRDEF("file.txt")), BUFSTRDEF("ABCD")), ProtocolError,
"HTTP request failed with 403 (Forbidden):\n"
"*** Path/Query ***:\n"
"/upload/storage/v1/b/bucket/o?fields=md5Hash%%2Csize&name=file.txt&uploadType=media\n"
"POST /upload/storage/v1/b/bucket/o?fields=md5Hash%%2Csize&name=file.txt&uploadType=media\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 4\n"
@ -634,7 +634,7 @@ testRun(void)
storagePutP(storageNewWriteP(storage, STRDEF("file.txt")), BUFSTRDEF("12345678901234567")), ProtocolError,
"HTTP request failed with 403 (Forbidden):\n"
"*** Path/Query ***:\n"
"/upload/storage/v1/b/bucket/o?name=file.txt&uploadType=resumable&upload_id=<redacted>\n"
"PUT /upload/storage/v1/b/bucket/o?name=file.txt&uploadType=resumable&upload_id=<redacted>\n"
"*** Request Headers ***:\n"
"content-length: 16\n"
"content-range: bytes 0-15/*\n"

View File

@ -478,7 +478,7 @@ testRun(void)
storageGetP(storageNewReadP(s3, STRDEF("file.txt"))), ProtocolError,
"HTTP request failed with 301:\n"
"*** Path/Query ***:\n"
"/latest/meta-data/iam/security-credentials\n"
"GET /latest/meta-data/iam/security-credentials\n"
"*** Request Headers ***:\n"
"content-length: 0\n"
"host: %s",
@ -519,7 +519,7 @@ testRun(void)
storageGetP(storageNewReadP(s3, STRDEF("file.txt"))), ProtocolError,
"HTTP request failed with 300:\n"
"*** Path/Query ***:\n"
"/latest/meta-data/iam/security-credentials/credrole\n"
"GET /latest/meta-data/iam/security-credentials/credrole\n"
"*** Request Headers ***:\n"
"content-length: 0\n"
"host: %s",
@ -583,7 +583,7 @@ testRun(void)
ioReadOpen(storageReadIo(read)), ProtocolError,
"HTTP request failed with 303:\n"
"*** Path/Query ***:\n"
"/file.txt\n"
"GET /file.txt\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 0\n"
@ -730,7 +730,7 @@ testRun(void)
storagePutP(write, BUFSTRDEF("12345678901234567890123456789012")), ProtocolError,
"HTTP request failed with 200 (OK):\n"
"*** Path/Query ***:\n"
"/file.txt?uploadId=WxRt\n"
"POST /file.txt?uploadId=WxRt\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 205\n"
@ -926,7 +926,7 @@ testRun(void)
TEST_ERROR(storageListP(s3, STRDEF("/")), ProtocolError,
"HTTP request failed with 344:\n"
"*** Path/Query ***:\n"
"/?delimiter=%2F&list-type=2\n"
"GET /?delimiter=%2F&list-type=2\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 0\n"
@ -950,7 +950,7 @@ testRun(void)
TEST_ERROR(storageListP(s3, STRDEF("/")), ProtocolError,
"HTTP request failed with 344:\n"
"*** Path/Query ***:\n"
"/?delimiter=%2F&list-type=2\n"
"GET /?delimiter=%2F&list-type=2\n"
"*** Request Headers ***:\n"
"authorization: <redacted>\n"
"content-length: 0\n"