|
|
@ -159,12 +159,23 @@ func (api CloudStorageAPI) PutObjectHandler(w http.ResponseWriter, req *http.Req |
|
|
|
var err *probe.Error |
|
|
|
var err *probe.Error |
|
|
|
signature, err = initSignatureV4(req) |
|
|
|
signature, err = initSignatureV4(req) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
switch err.ToGoError() { |
|
|
|
|
|
|
|
case errInvalidRegion: |
|
|
|
|
|
|
|
errorIf(err.Trace(), "Unknown region in authorization header.", nil) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, AuthorizationHeaderMalformed, req.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
case errAccessKeyIDInvalid: |
|
|
|
|
|
|
|
errorIf(err.Trace(), "Invalid access key id.", nil) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, InvalidAccessKeyID, req.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
default: |
|
|
|
errorIf(err.Trace(), "Initializing signature v4 failed.", nil) |
|
|
|
errorIf(err.Trace(), "Initializing signature v4 failed.", nil) |
|
|
|
writeErrorResponse(w, req, InternalError, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
metadata, err := api.Filesystem.CreateObject(bucket, object, md5, size, req.Body, signature) |
|
|
|
metadata, err := api.Filesystem.CreateObject(bucket, object, md5, size, req.Body, signature) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -295,12 +306,23 @@ func (api CloudStorageAPI) PutObjectPartHandler(w http.ResponseWriter, req *http |
|
|
|
var err *probe.Error |
|
|
|
var err *probe.Error |
|
|
|
signature, err = initSignatureV4(req) |
|
|
|
signature, err = initSignatureV4(req) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
switch err.ToGoError() { |
|
|
|
|
|
|
|
case errInvalidRegion: |
|
|
|
|
|
|
|
errorIf(err.Trace(), "Unknown region in authorization header.", nil) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, AuthorizationHeaderMalformed, req.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
case errAccessKeyIDInvalid: |
|
|
|
|
|
|
|
errorIf(err.Trace(), "Invalid access key id.", nil) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, InvalidAccessKeyID, req.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
default: |
|
|
|
errorIf(err.Trace(), "Initializing signature v4 failed.", nil) |
|
|
|
errorIf(err.Trace(), "Initializing signature v4 failed.", nil) |
|
|
|
writeErrorResponse(w, req, InternalError, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
calculatedMD5, err := api.Filesystem.CreateObjectPart(bucket, object, uploadID, md5, partID, size, req.Body, signature) |
|
|
|
calculatedMD5, err := api.Filesystem.CreateObjectPart(bucket, object, uploadID, md5, partID, size, req.Body, signature) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -439,12 +461,23 @@ func (api CloudStorageAPI) CompleteMultipartUploadHandler(w http.ResponseWriter, |
|
|
|
var err *probe.Error |
|
|
|
var err *probe.Error |
|
|
|
signature, err = initSignatureV4(req) |
|
|
|
signature, err = initSignatureV4(req) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
switch err.ToGoError() { |
|
|
|
|
|
|
|
case errInvalidRegion: |
|
|
|
|
|
|
|
errorIf(err.Trace(), "Unknown region in authorization header.", nil) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, AuthorizationHeaderMalformed, req.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
case errAccessKeyIDInvalid: |
|
|
|
|
|
|
|
errorIf(err.Trace(), "Invalid access key id.", nil) |
|
|
|
|
|
|
|
writeErrorResponse(w, req, InvalidAccessKeyID, req.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
default: |
|
|
|
errorIf(err.Trace(), "Initializing signature v4 failed.", nil) |
|
|
|
errorIf(err.Trace(), "Initializing signature v4 failed.", nil) |
|
|
|
writeErrorResponse(w, req, InternalError, req.URL.Path) |
|
|
|
writeErrorResponse(w, req, InternalError, req.URL.Path) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
metadata, err := api.Filesystem.CompleteMultipartUpload(bucket, object, objectResourcesMetadata.UploadID, req.Body, signature) |
|
|
|
metadata, err := api.Filesystem.CompleteMultipartUpload(bucket, object, objectResourcesMetadata.UploadID, req.Body, signature) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|