|
@ -32,7 +32,7 @@ func (s3a *S3ApiServer) NewMultipartUploadHandler(w http.ResponseWriter, r *http |
|
|
glog.V(2).Info("NewMultipartUploadHandler", string(encodeResponse(response)), errCode) |
|
|
glog.V(2).Info("NewMultipartUploadHandler", string(encodeResponse(response)), errCode) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, errCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, errCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ func (s3a *S3ApiServer) CompleteMultipartUploadHandler(w http.ResponseWriter, r |
|
|
glog.V(2).Info("CompleteMultipartUploadHandler", string(encodeResponse(response)), errCode) |
|
|
glog.V(2).Info("CompleteMultipartUploadHandler", string(encodeResponse(response)), errCode) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, errCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, errCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -78,7 +78,7 @@ func (s3a *S3ApiServer) AbortMultipartUploadHandler(w http.ResponseWriter, r *ht |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, errCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, errCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -94,13 +94,13 @@ func (s3a *S3ApiServer) ListMultipartUploadsHandler(w http.ResponseWriter, r *ht |
|
|
|
|
|
|
|
|
prefix, keyMarker, uploadIDMarker, delimiter, maxUploads, encodingType := getBucketMultipartResources(r.URL.Query()) |
|
|
prefix, keyMarker, uploadIDMarker, delimiter, maxUploads, encodingType := getBucketMultipartResources(r.URL.Query()) |
|
|
if maxUploads < 0 { |
|
|
if maxUploads < 0 { |
|
|
writeErrorResponse(w, s3err.ErrInvalidMaxUploads, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrInvalidMaxUploads, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if keyMarker != "" { |
|
|
if keyMarker != "" { |
|
|
// Marker not common with prefix is not implemented.
|
|
|
// Marker not common with prefix is not implemented.
|
|
|
if !strings.HasPrefix(keyMarker, prefix) { |
|
|
if !strings.HasPrefix(keyMarker, prefix) { |
|
|
writeErrorResponse(w, s3err.ErrNotImplemented, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrNotImplemented, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -118,7 +118,7 @@ func (s3a *S3ApiServer) ListMultipartUploadsHandler(w http.ResponseWriter, r *ht |
|
|
glog.V(2).Info("ListMultipartUploadsHandler", string(encodeResponse(response)), errCode) |
|
|
glog.V(2).Info("ListMultipartUploadsHandler", string(encodeResponse(response)), errCode) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, errCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, errCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -133,11 +133,11 @@ func (s3a *S3ApiServer) ListObjectPartsHandler(w http.ResponseWriter, r *http.Re |
|
|
|
|
|
|
|
|
uploadID, partNumberMarker, maxParts, _ := getObjectResources(r.URL.Query()) |
|
|
uploadID, partNumberMarker, maxParts, _ := getObjectResources(r.URL.Query()) |
|
|
if partNumberMarker < 0 { |
|
|
if partNumberMarker < 0 { |
|
|
writeErrorResponse(w, s3err.ErrInvalidPartNumberMarker, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrInvalidPartNumberMarker, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if maxParts < 0 { |
|
|
if maxParts < 0 { |
|
|
writeErrorResponse(w, s3err.ErrInvalidMaxParts, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrInvalidMaxParts, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -152,7 +152,7 @@ func (s3a *S3ApiServer) ListObjectPartsHandler(w http.ResponseWriter, r *http.Re |
|
|
glog.V(2).Info("ListObjectPartsHandler", string(encodeResponse(response)), errCode) |
|
|
glog.V(2).Info("ListObjectPartsHandler", string(encodeResponse(response)), errCode) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, errCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, errCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -167,18 +167,18 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ |
|
|
uploadID := r.URL.Query().Get("uploadId") |
|
|
uploadID := r.URL.Query().Get("uploadId") |
|
|
exists, err := s3a.exists(s3a.genUploadsFolder(bucket), uploadID, true) |
|
|
exists, err := s3a.exists(s3a.genUploadsFolder(bucket), uploadID, true) |
|
|
if !exists { |
|
|
if !exists { |
|
|
writeErrorResponse(w, s3err.ErrNoSuchUpload, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrNoSuchUpload, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
partIDString := r.URL.Query().Get("partNumber") |
|
|
partIDString := r.URL.Query().Get("partNumber") |
|
|
partID, err := strconv.Atoi(partIDString) |
|
|
partID, err := strconv.Atoi(partIDString) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
writeErrorResponse(w, s3err.ErrInvalidPart, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrInvalidPart, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if partID > globalMaxPartID { |
|
|
if partID > globalMaxPartID { |
|
|
writeErrorResponse(w, s3err.ErrInvalidMaxParts, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3err.ErrInvalidMaxParts, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -195,7 +195,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ |
|
|
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r) |
|
|
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r) |
|
|
} |
|
|
} |
|
|
if s3ErrCode != s3err.ErrNone { |
|
|
if s3ErrCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, s3ErrCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, s3ErrCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -207,7 +207,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ |
|
|
etag, errCode := s3a.putToFiler(r, uploadUrl, dataReader) |
|
|
etag, errCode := s3a.putToFiler(r, uploadUrl, dataReader) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
writeErrorResponse(w, errCode, r.URL) |
|
|
|
|
|
|
|
|
writeErrorResponse(w, errCode, r) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|