Read req.Body for PutBucket() if any

This commit is contained in:
Harshavardhana
2015-07-14 09:17:30 -07:00
parent e4dd49bdd9
commit c4cf7635bf
5 changed files with 48 additions and 28 deletions

View File

@@ -296,7 +296,17 @@ func (api Minio) PutBucketHandler(w http.ResponseWriter, req *http.Request) {
}
}
err := api.Donut.MakeBucket(bucket, getACLTypeString(aclType), signature)
// if body of request is non-nil then check for validity of Content-Length
if req.Body != nil {
/// if Content-Length missing, deny the request
size := req.Header.Get("Content-Length")
if size == "" {
writeErrorResponse(w, req, MissingContentLength, acceptsContentType, req.URL.Path)
return
}
}
err := api.Donut.MakeBucket(bucket, getACLTypeString(aclType), req.Body, signature)
switch iodine.ToError(err).(type) {
case nil:
// Make sure to add Location information here only for bucket