Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS sending back 400 Bad Request HTTP responses that work upon retry.… #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/App/MtAws/GlacierRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ sub perform_lwp
print "PID $$ HTTP ".$resp->code." This might be normal. Will retry ($dt seconds spent for request)\n";
$self->{last_retry_reason} = $resp->code;
throttle($i);
} elsif ($resp->code =~ /^400$/) {
print "PID $$ HTTP ".$resp->code." Unexpected 400 Bad Request response received. Will retry ($dt seconds spent for request)\n";
$self->{last_retry_reason} = $resp->code;
throttle($i);
} elsif (defined($resp->header('X-Died')) && (get_exception($resp->header('X-Died')))) {
die $resp->header('X-Died'); # propogate our own exceptions
} elsif (defined($resp->header('X-Died')) && length($resp->header('X-Died'))) {
Expand All @@ -569,7 +573,7 @@ sub perform_lwp
return $resp;
}
} else {
if ($resp->code =~ /^40[03]$/) {
if ($resp->code =~ /^403$/) {
if ($resp->content_type && $resp->content_type eq 'application/json') {
my $json = JSON::XS->new->allow_nonref;
my $scalar = eval { $json->decode( $resp->content ); }; # we assume content always in utf8
Expand Down