Merge pull request #142 from harshavardhana/pr_out_avoid_trailing_for_buckets_and_also_re_directs_in_accordance_with_aws_clients

master
Harshavardhana 10 years ago
commit 58f2c73f42
  1. 6
      pkg/api/minioapi/minioapi.go
  2. 4
      pkg/utils/crypto/signers/signers.go

@ -67,11 +67,9 @@ func HttpHandler(storage mstorage.Storage) http.Handler {
log.Fatal(err) log.Fatal(err)
} }
// Re-direct /path to /path/
mux.StrictSlash(true)
mux.HandleFunc("/", api.listBucketsHandler).Methods("GET") mux.HandleFunc("/", api.listBucketsHandler).Methods("GET")
mux.HandleFunc("/{bucket}/", api.listObjectsHandler).Methods("GET") mux.HandleFunc("/{bucket}", api.listObjectsHandler).Methods("GET")
mux.HandleFunc("/{bucket}/", api.putBucketHandler).Methods("PUT") mux.HandleFunc("/{bucket}", api.putBucketHandler).Methods("PUT")
mux.HandleFunc("/{bucket}/{object:.*}", api.getObjectHandler).Methods("GET") mux.HandleFunc("/{bucket}/{object:.*}", api.getObjectHandler).Methods("GET")
mux.HandleFunc("/{bucket}/{object:.*}", api.headObjectHandler).Methods("HEAD") mux.HandleFunc("/{bucket}/{object:.*}", api.headObjectHandler).Methods("HEAD")
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT") mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT")

@ -47,6 +47,10 @@ func ValidateRequest(user config.User, req *http.Request) (bool, error) {
encoder.Write(hm.Sum(nil)) encoder.Write(hm.Sum(nil))
encoder.Close() 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() { if req.Header.Get("Authorization") != authHeader.String() {
return false, fmt.Errorf("Authorization header mismatch") return false, fmt.Errorf("Authorization header mismatch")
} }

Loading…
Cancel
Save