bucket-handlers: fix missing return statement (#2553)

If the location was invalid, it would write an error response but then
continue to attempt to make the bucket. Whether or not it would succeed,
it would attempt to call response.WriteHeaders twice in a row, which
would cause a message to be logged to the server console (bad).

Here is the relevant Go code:
c80e0d374b/src/net/http/server.go (L878-L881)
master
Brendan Ashworth 8 years ago committed by Harshavardhana
parent 418921de89
commit b67c8970c9
  1. 1
      cmd/bucket-handlers.go

@ -284,6 +284,7 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
// requests which do not follow valid region requirements. // requests which do not follow valid region requirements.
if s3Error := isValidLocationConstraint(r); s3Error != ErrNone { if s3Error := isValidLocationConstraint(r); s3Error != ErrNone {
writeErrorResponse(w, r, s3Error, r.URL.Path) writeErrorResponse(w, r, s3Error, r.URL.Path)
return
} }
// Proceed to creating a bucket. // Proceed to creating a bucket.

Loading…
Cancel
Save