routers: Fix order of PostPolicyHandlers and headers.

master
Harshavardhana 9 years ago
parent 600a932acb
commit 76bda0d8f1
  1. 3
      bucket-handlers.go
  2. 4
      routers.go

@ -518,8 +518,7 @@ func extractHTTPFormValues(reader *multipart.Reader) (io.Reader, map[string]stri
// signature policy in multipart/form-data // signature policy in multipart/form-data
func (api storageAPI) PostPolicyBucketHandler(w http.ResponseWriter, r *http.Request) { func (api storageAPI) PostPolicyBucketHandler(w http.ResponseWriter, r *http.Request) {
// Here the parameter is the size of the form data that should // Here the parameter is the size of the form data that should
// be loaded in memory, the remaining being put in temporary // be loaded in memory, the remaining being put in temporary files.
// files
reader, e := r.MultipartReader() reader, e := r.MultipartReader()
if e != nil { if e != nil {
errorIf(probe.NewError(e), "Unable to initialize multipart reader.", nil) errorIf(probe.NewError(e), "Unable to initialize multipart reader.", nil)

@ -149,10 +149,10 @@ func registerAPIHandlers(mux *router.Router, a storageAPI, w *webAPI) {
bucket.Methods("PUT").HandlerFunc(a.PutBucketHandler) bucket.Methods("PUT").HandlerFunc(a.PutBucketHandler)
// HeadBucket // HeadBucket
bucket.Methods("HEAD").HandlerFunc(a.HeadBucketHandler) bucket.Methods("HEAD").HandlerFunc(a.HeadBucketHandler)
// PostPolicy
bucket.Methods("POST").HeadersRegexp("Content-Type", "multipart/form-data*").HandlerFunc(a.PostPolicyBucketHandler)
// DeleteMultipleObjects // DeleteMultipleObjects
bucket.Methods("POST").HandlerFunc(a.DeleteMultipleObjectsHandler) bucket.Methods("POST").HandlerFunc(a.DeleteMultipleObjectsHandler)
// PostPolicy
bucket.Methods("POST").Headers("Content-Type", "multipart/form-data").HandlerFunc(a.PostPolicyBucketHandler)
// DeleteBucketPolicy // DeleteBucketPolicy
bucket.Methods("DELETE").HandlerFunc(a.DeleteBucketPolicyHandler).Queries("policy", "") bucket.Methods("DELETE").HandlerFunc(a.DeleteBucketPolicyHandler).Queries("policy", "")
// DeleteBucket // DeleteBucket

Loading…
Cancel
Save