|
|
@ -155,15 +155,18 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques |
|
|
|
writeErrorResponse(w, req, InvalidDigest, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InvalidDigest, acceptsContentType, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// if Content-Length missing, incomplete request throw IncompleteBody
|
|
|
|
size := req.Header.Get("Content-Length") |
|
|
|
size := req.Header.Get("Content-Length") |
|
|
|
if size == "" { |
|
|
|
if size == "" { |
|
|
|
writeErrorResponse(w, req, IncompleteBody, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, IncompleteBody, acceptsContentType, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// maximum Upload size for objects in a single operation
|
|
|
|
if isMaxObjectSize(size) { |
|
|
|
if isMaxObjectSize(size) { |
|
|
|
writeErrorResponse(w, req, EntityTooLarge, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, EntityTooLarge, acceptsContentType, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// minimum Upload size for objects in a single operation
|
|
|
|
if isMinObjectSize(size) { |
|
|
|
if isMinObjectSize(size) { |
|
|
|
writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
@ -171,9 +174,9 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques |
|
|
|
err := server.driver.CreateObject(bucket, object, "", md5, req.Body) |
|
|
|
err := server.driver.CreateObject(bucket, object, "", md5, req.Body) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
w.Header().Set("Server", "Minio") |
|
|
|
{ |
|
|
|
w.Header().Set("Connection", "close") |
|
|
|
writeSuccessResponse(w) |
|
|
|
w.WriteHeader(http.StatusOK) |
|
|
|
} |
|
|
|
case drivers.ObjectExists: |
|
|
|
case drivers.ObjectExists: |
|
|
|
{ |
|
|
|
{ |
|
|
|
writeErrorResponse(w, req, MethodNotAllowed, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, MethodNotAllowed, acceptsContentType, req.URL.Path) |
|
|
|