|
|
@ -50,7 +50,7 @@ func (server *minioAPI) getObjectHandler(w http.ResponseWriter, req *http.Reques |
|
|
|
object = vars["object"] |
|
|
|
object = vars["object"] |
|
|
|
|
|
|
|
|
|
|
|
metadata, err := server.driver.GetObjectMetadata(bucket, object) |
|
|
|
metadata, err := server.driver.GetObjectMetadata(bucket, object) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: // success
|
|
|
|
case nil: // success
|
|
|
|
{ |
|
|
|
{ |
|
|
|
httpRange, err := getRequestedRange(req, metadata.Size) |
|
|
|
httpRange, err := getRequestedRange(req, metadata.Size) |
|
|
@ -63,7 +63,7 @@ func (server *minioAPI) getObjectHandler(w http.ResponseWriter, req *http.Reques |
|
|
|
setObjectHeaders(w, metadata) |
|
|
|
setObjectHeaders(w, metadata) |
|
|
|
if _, err := server.driver.GetObject(w, bucket, object); err != nil { |
|
|
|
if _, err := server.driver.GetObject(w, bucket, object); err != nil { |
|
|
|
// unable to write headers, we've already printed data. Just close the connection.
|
|
|
|
// unable to write headers, we've already printed data. Just close the connection.
|
|
|
|
log.Error.Println(err) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
} |
|
|
|
} |
|
|
|
case false: |
|
|
|
case false: |
|
|
|
metadata.Size = httpRange.length |
|
|
|
metadata.Size = httpRange.length |
|
|
@ -107,7 +107,7 @@ func (server *minioAPI) headObjectHandler(w http.ResponseWriter, req *http.Reque |
|
|
|
object = vars["object"] |
|
|
|
object = vars["object"] |
|
|
|
|
|
|
|
|
|
|
|
metadata, err := server.driver.GetObjectMetadata(bucket, object) |
|
|
|
metadata, err := server.driver.GetObjectMetadata(bucket, object) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectHeaders(w, metadata) |
|
|
|
setObjectHeaders(w, metadata) |
|
|
@ -178,7 +178,7 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
calculatedMD5, err := server.driver.CreateObject(bucket, object, "", md5, sizeInt64, req.Body) |
|
|
|
calculatedMD5, err := server.driver.CreateObject(bucket, object, "", md5, sizeInt64, req.Body) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
w.Header().Set("ETag", calculatedMD5) |
|
|
|
w.Header().Set("ETag", calculatedMD5) |
|
|
@ -201,14 +201,9 @@ 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) |
|
|
|
} |
|
|
|
} |
|
|
|
case drivers.ImplementationError: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
log.Error.Println(err) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.Error.Println(err) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -231,7 +226,7 @@ func (server *minioAPI) newMultipartUploadHandler(w http.ResponseWriter, req *ht |
|
|
|
bucket = vars["bucket"] |
|
|
|
bucket = vars["bucket"] |
|
|
|
object = vars["object"] |
|
|
|
object = vars["object"] |
|
|
|
uploadID, err := server.driver.NewMultipartUpload(bucket, object, "") |
|
|
|
uploadID, err := server.driver.NewMultipartUpload(bucket, object, "") |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
response := generateInitiateMultipartUploadResult(bucket, object, uploadID) |
|
|
|
response := generateInitiateMultipartUploadResult(bucket, object, uploadID) |
|
|
@ -247,7 +242,7 @@ func (server *minioAPI) newMultipartUploadHandler(w http.ResponseWriter, req *ht |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.Println(iodine.New(err, nil)) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -307,7 +302,7 @@ func (server *minioAPI) putObjectPartHandler(w http.ResponseWriter, req *http.Re |
|
|
|
writeErrorResponse(w, req, InvalidPart, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InvalidPart, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
calculatedMD5, err := server.driver.CreateObjectPart(bucket, object, uploadID, partID, "", md5, sizeInt64, req.Body) |
|
|
|
calculatedMD5, err := server.driver.CreateObjectPart(bucket, object, uploadID, partID, "", md5, sizeInt64, req.Body) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
w.Header().Set("ETag", calculatedMD5) |
|
|
|
w.Header().Set("ETag", calculatedMD5) |
|
|
@ -336,7 +331,7 @@ func (server *minioAPI) putObjectPartHandler(w http.ResponseWriter, req *http.Re |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.Error.Println(err) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -356,7 +351,7 @@ func (server *minioAPI) abortMultipartUploadHandler(w http.ResponseWriter, req * |
|
|
|
objectResourcesMetadata := getObjectResources(req.URL.Query()) |
|
|
|
objectResourcesMetadata := getObjectResources(req.URL.Query()) |
|
|
|
|
|
|
|
|
|
|
|
err := server.driver.AbortMultipartUpload(bucket, object, objectResourcesMetadata.UploadID) |
|
|
|
err := server.driver.AbortMultipartUpload(bucket, object, objectResourcesMetadata.UploadID) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
setCommonHeaders(w, getContentTypeString(acceptsContentType), 0) |
|
|
|
setCommonHeaders(w, getContentTypeString(acceptsContentType), 0) |
|
|
@ -368,7 +363,7 @@ func (server *minioAPI) abortMultipartUploadHandler(w http.ResponseWriter, req * |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.Println(err) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -391,7 +386,7 @@ func (server *minioAPI) listObjectPartsHandler(w http.ResponseWriter, req *http. |
|
|
|
object := vars["object"] |
|
|
|
object := vars["object"] |
|
|
|
|
|
|
|
|
|
|
|
objectResourcesMetadata, err := server.driver.ListObjectParts(bucket, object, objectResourcesMetadata) |
|
|
|
objectResourcesMetadata, err := server.driver.ListObjectParts(bucket, object, objectResourcesMetadata) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
response := generateListPartsResult(objectResourcesMetadata) |
|
|
|
response := generateListPartsResult(objectResourcesMetadata) |
|
|
@ -407,7 +402,7 @@ func (server *minioAPI) listObjectPartsHandler(w http.ResponseWriter, req *http. |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.Println(err) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -444,7 +439,7 @@ func (server *minioAPI) completeMultipartUploadHandler(w http.ResponseWriter, re |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
etag, err := server.driver.CompleteMultipartUpload(bucket, object, objectResourcesMetadata.UploadID, partMap) |
|
|
|
etag, err := server.driver.CompleteMultipartUpload(bucket, object, objectResourcesMetadata.UploadID, partMap) |
|
|
|
switch err := iodine.ToError(err).(type) { |
|
|
|
switch iodine.ToError(err).(type) { |
|
|
|
case nil: |
|
|
|
case nil: |
|
|
|
{ |
|
|
|
{ |
|
|
|
response := generateCompleteMultpartUploadResult(bucket, object, "", etag) |
|
|
|
response := generateCompleteMultpartUploadResult(bucket, object, "", etag) |
|
|
@ -460,7 +455,7 @@ func (server *minioAPI) completeMultipartUploadHandler(w http.ResponseWriter, re |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
{ |
|
|
|
{ |
|
|
|
log.Println(iodine.New(err, nil)) |
|
|
|
log.Error.Println(iodine.New(err, nil)) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|