+ Improve S3 error reporting.
+
diff --git a/lib/pgBackRest/Common/Http/Client.pm b/lib/pgBackRest/Common/Http/Client.pm
index d5baf3d3e..e6e8eda8c 100644
--- a/lib/pgBackRest/Common/Http/Client.pm
+++ b/lib/pgBackRest/Common/Http/Client.pm
@@ -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}}
diff --git a/lib/pgBackRest/Storage/S3/Request.pm b/lib/pgBackRest/Storage/S3/Request.pm
index 9bcf0eba6..dee954f11 100644
--- a/lib/pgBackRest/Storage/S3/Request.pm
+++ b/lib/pgBackRest/Storage/S3/Request.pm
@@ -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);
}
}