From ecb70a4c19b2a0829ac25aeed18cbbede523ed48 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 6 Feb 2015 20:42:09 -0800 Subject: [PATCH] Avoid trailing '/' for buckets and also re-directs - in accordance with aws clients --- pkg/api/minioapi/minioapi.go | 6 ++---- pkg/utils/crypto/signers/signers.go | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/api/minioapi/minioapi.go b/pkg/api/minioapi/minioapi.go index 1af306774..c619b8db2 100644 --- a/pkg/api/minioapi/minioapi.go +++ b/pkg/api/minioapi/minioapi.go @@ -67,11 +67,9 @@ func HttpHandler(storage mstorage.Storage) http.Handler { log.Fatal(err) } - // Re-direct /path to /path/ - mux.StrictSlash(true) mux.HandleFunc("/", api.listBucketsHandler).Methods("GET") - mux.HandleFunc("/{bucket}/", api.listObjectsHandler).Methods("GET") - mux.HandleFunc("/{bucket}/", api.putBucketHandler).Methods("PUT") + mux.HandleFunc("/{bucket}", api.listObjectsHandler).Methods("GET") + mux.HandleFunc("/{bucket}", api.putBucketHandler).Methods("PUT") mux.HandleFunc("/{bucket}/{object:.*}", api.getObjectHandler).Methods("GET") mux.HandleFunc("/{bucket}/{object:.*}", api.headObjectHandler).Methods("HEAD") mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT") diff --git a/pkg/utils/crypto/signers/signers.go b/pkg/utils/crypto/signers/signers.go index f7cc473ba..ad88e7bf7 100644 --- a/pkg/utils/crypto/signers/signers.go +++ b/pkg/utils/crypto/signers/signers.go @@ -47,6 +47,10 @@ func ValidateRequest(user config.User, req *http.Request) (bool, error) { encoder.Write(hm.Sum(nil)) encoder.Close() + // DEBUG + // fmt.Println("Request header sent: ", req.Header.Get("Authorization")) + // fmt.Println("Header calculated: ", authHeader.String()) + // fmt.Printf("%q : %x", ss, ss) if req.Header.Get("Authorization") != authHeader.String() { return false, fmt.Errorf("Authorization header mismatch") }