Many S3 compatibility improvements:

- return XML errors
- implement AuthorizationHeaderMalformed error to redirect clients to
  correct location (used by minio client)
- implement GetBucketLocation
- fix DeleteObjects XML parsing and response
This commit is contained in:
Alex Auvolat
2021-04-28 01:05:40 +02:00
parent 368eb35484
commit dcfc32cf85
6 changed files with 98 additions and 16 deletions
+4 -5
View File
@@ -58,10 +58,7 @@ pub async fn check_signature(
garage.config.s3_api.s3_region
);
if authorization.scope != scope {
return Err(Error::BadRequest(format!(
"Invalid scope in authorization field, expected: {}",
scope
)));
return Err(Error::AuthorizationHeaderMalformed(scope.to_string()));
}
let key = garage
@@ -101,7 +98,9 @@ pub async fn check_signature(
return Err(Error::Forbidden(format!("Invalid signature")));
}
let content_sha256 = if authorization.content_sha256 == "UNSIGNED-PAYLOAD" {
let content_sha256 = if authorization.content_sha256 == "UNSIGNED-PAYLOAD"
|| authorization.content_sha256 == "STREAMING-AWS4-HMAC-SHA256-PAYLOAD"
{
None
} else {
let bytes = hex::decode(authorization.content_sha256)