diff --git a/bucket-handlers.go b/bucket-handlers.go index f77731b48..c9de6505b 100644 --- a/bucket-handlers.go +++ b/bucket-handlers.go @@ -230,7 +230,7 @@ func (api CloudStorageAPI) PutBucketHandler(w http.ResponseWriter, req *http.Req // if body of request is non-nil then check for validity of Content-Length if req.Body != nil { /// if Content-Length is unknown/missing, deny the request - if req.ContentLength == -1 { + if req.ContentLength == -1 && !contains(req.TransferEncoding, "chunked") { writeErrorResponse(w, req, MissingContentLength, req.URL.Path) return } diff --git a/utils.go b/utils.go index f7a4ca7c1..c478008a1 100644 --- a/utils.go +++ b/utils.go @@ -46,3 +46,13 @@ func isMaxObjectSize(size int64) bool { } return false } + +func contains(stringList []string, element string) bool { + for _, e := range stringList { + if e == element { + return true + } + } + + return false +}