1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

Improve S3 error reporting.

This commit is contained in:
David Steele 2017-06-21 20:46:49 -04:00
parent 8b9965abcb
commit f596702c5b
3 changed files with 11 additions and 3 deletions

View File

@ -182,6 +182,10 @@
<release-item>
<p>Remove support for <postgres/> 8.3.</p>
</release-item>
<release-item>
<p>Improve <proper>S3</proper> error reporting.</p>
</release-item>
</release-refactor-list>
</release-core-list>

View File

@ -127,13 +127,13 @@ sub new
# Read the response headers
$self->{iContentLength} = undef;
my $strResponseHeader = '';
$self->{strResponseHeader} = '';
my $strHeader = trim($self->readLine());
while ($strHeader ne '')
{
# Validate header
$strResponseHeader .= "${strHeader}\n";
$self->{strResponseHeader} .= "${strHeader}\n";
my $iColonPos = index($strHeader, ':');
@ -275,8 +275,10 @@ sub responseBody
# Properties.
####################################################################################################################################
sub contentLength {shift->{iContentLength}} # Content length if available (-1 means not known yet)
sub requestHeaderText {trim(shift->{strRequestHeader})}
sub responseCode {shift->{iResponseCode}}
sub responseHeader {shift->{hResponseHeader}}
sub responseHeaderText {trim(shift->{strResponseHeader})}
sub responseMessage {shift->{strResponseMessage}}
sub responseProtocol {shift->{strResponseProtocol}}

View File

@ -186,7 +186,9 @@ sub request
confess &log(ERROR,
"S3 request error [$iReponseCode] " . $oHttpClient->responseMessage() .
(defined($$rstrResponseBody) ? ":\n${$rstrResponseBody}" : ''),
"\n*** request header ***\n" . $oHttpClient->requestHeaderText() .
"\n*** reponse header ***\n" . $oHttpClient->responseHeaderText() .
(defined($$rstrResponseBody) ? "\n*** response body ***\n${$rstrResponseBody}" : ''),
ERROR_PROTOCOL);
}
}