Parse more specific AWS error codes (#1549)

Fixes #1545.
This commit is contained in:
Andrew Gaul 2021-02-07 11:29:08 +09:00 committed by GitHub
parent 4c6690f5f0
commit ff9d6a75c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2269,6 +2269,18 @@ int S3fsCurl::RequestPerform(bool dontAddAuthHeaders /*=false*/)
break; break;
} }
{
// Try to parse more specific AWS error code otherwise fall back to HTTP error code.
std::string value;
if(simple_parse_xml(bodydata.str(), bodydata.size(), "Code", value)){
// TODO: other error codes
if(value == "EntityTooLarge"){
result = -EFBIG;
break;
}
}
}
// Service response codes which are >= 300 && < 500 // Service response codes which are >= 300 && < 500
switch(responseCode){ switch(responseCode){
case 301: case 301: