mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
HEAD request should have Content-Length for only successful response, there is no response body for errors, just header is sufficient - fixes #603
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 """ in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET. """
This commit is contained in:
@@ -285,11 +285,31 @@ func (server *minioAPI) putBucketACLHandler(w http.ResponseWriter, req *http.Req
|
||||
// return responses such as 404 Not Found and 403 Forbidden.
|
||||
func (server *minioAPI) headBucketHandler(w http.ResponseWriter, req *http.Request) {
|
||||
acceptsContentType := getContentType(req)
|
||||
// verify if bucket allows this operation
|
||||
if !server.isValidOp(w, req, acceptsContentType) {
|
||||
return
|
||||
}
|
||||
|
||||
// Always a success if isValidOp succeeds
|
||||
writeSuccessResponse(w, acceptsContentType)
|
||||
vars := mux.Vars(req)
|
||||
bucket := vars["bucket"]
|
||||
|
||||
_, err := server.driver.GetBucketMetadata(bucket)
|
||||
switch iodine.ToError(err).(type) {
|
||||
case nil:
|
||||
{
|
||||
writeSuccessResponse(w, acceptsContentType)
|
||||
}
|
||||
case drivers.BucketNotFound:
|
||||
{
|
||||
error := getErrorCode(NoSuchBucket)
|
||||
w.WriteHeader(error.HTTPStatusCode)
|
||||
}
|
||||
case drivers.BucketNameInvalid:
|
||||
{
|
||||
error := getErrorCode(InvalidBucketName)
|
||||
w.WriteHeader(error.HTTPStatusCode)
|
||||
}
|
||||
default:
|
||||
{
|
||||
log.Println(err)
|
||||
error := getErrorCode(InternalError)
|
||||
w.WriteHeader(error.HTTPStatusCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user