From 73a308502fbbecd1494369fa10beedf512efd3dd Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Tue, 2 Jun 2020 02:08:19 +0100 Subject: [PATCH] Relax content-md5 requirement in set encryption handler (#9750) aws cli fails to set a bucket encryption configuration to MinIO server. The reason is that aws cli does not send MD5-Content header. It seems that MD5-Content is not required anymore. This commit also returns Not Implemented header early to help mint tests to ignore testing this API in gateway modes. --- cmd/bucket-encryption-handlers.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/bucket-encryption-handlers.go b/cmd/bucket-encryption-handlers.go index 5113fa3c1..866ba2079 100644 --- a/cmd/bucket-encryption-handlers.go +++ b/cmd/bucket-encryption-handlers.go @@ -23,7 +23,6 @@ import ( "net/http" "github.com/gorilla/mux" - xhttp "github.com/minio/minio/cmd/http" "github.com/minio/minio/cmd/logger" "github.com/minio/minio/pkg/bucket/policy" ) @@ -46,15 +45,14 @@ func (api objectAPIHandlers) PutBucketEncryptionHandler(w http.ResponseWriter, r return } - vars := mux.Vars(r) - bucket := vars["bucket"] - - // PutBucketEncyrption API requires Content-Md5 - if _, ok := r.Header[xhttp.ContentMD5]; !ok { - writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrMissingContentMD5), r.URL, guessIsBrowserReq(r)) + if !objAPI.IsEncryptionSupported() { + writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL, guessIsBrowserReq(r)) return } + vars := mux.Vars(r) + bucket := vars["bucket"] + if s3Error := checkRequestAuthType(ctx, r, policy.PutBucketEncryptionAction, bucket, ""); s3Error != ErrNone { writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL, guessIsBrowserReq(r)) return