|
|
@ -45,7 +45,7 @@ func (s3a *S3ApiServer) NewMultipartUploadHandler(w http.ResponseWriter, r *http |
|
|
|
glog.V(2).Info("NewMultipartUploadHandler", string(s3err.EncodeXMLResponse(response)), errCode) |
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, errCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -69,7 +69,7 @@ func (s3a *S3ApiServer) CompleteMultipartUploadHandler(w http.ResponseWriter, r |
|
|
|
glog.V(2).Info("CompleteMultipartUploadHandler", string(s3err.EncodeXMLResponse(response)), errCode) |
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, errCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -91,7 +91,7 @@ func (s3a *S3ApiServer) AbortMultipartUploadHandler(w http.ResponseWriter, r *ht |
|
|
|
}) |
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, errCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -107,13 +107,13 @@ func (s3a *S3ApiServer) ListMultipartUploadsHandler(w http.ResponseWriter, r *ht |
|
|
|
|
|
|
|
prefix, keyMarker, uploadIDMarker, delimiter, maxUploads, encodingType := getBucketMultipartResources(r.URL.Query()) |
|
|
|
if maxUploads < 0 { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidMaxUploads, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidMaxUploads) |
|
|
|
return |
|
|
|
} |
|
|
|
if keyMarker != "" { |
|
|
|
// Marker not common with prefix is not implemented.
|
|
|
|
if !strings.HasPrefix(keyMarker, prefix) { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrNotImplemented, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrNotImplemented) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -131,7 +131,7 @@ func (s3a *S3ApiServer) ListMultipartUploadsHandler(w http.ResponseWriter, r *ht |
|
|
|
glog.V(2).Infof("ListMultipartUploadsHandler %s errCode=%d", string(s3err.EncodeXMLResponse(response)), errCode) |
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, errCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -146,11 +146,11 @@ func (s3a *S3ApiServer) ListObjectPartsHandler(w http.ResponseWriter, r *http.Re |
|
|
|
|
|
|
|
uploadID, partNumberMarker, maxParts, _ := getObjectResources(r.URL.Query()) |
|
|
|
if partNumberMarker < 0 { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidPartNumberMarker, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidPartNumberMarker) |
|
|
|
return |
|
|
|
} |
|
|
|
if maxParts < 0 { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidMaxParts, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidMaxParts) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -165,7 +165,7 @@ func (s3a *S3ApiServer) ListObjectPartsHandler(w http.ResponseWriter, r *http.Re |
|
|
|
glog.V(2).Infof("ListObjectPartsHandler %s count=%d", string(s3err.EncodeXMLResponse(response)), len(response.Part)) |
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, errCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -180,18 +180,18 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ |
|
|
|
uploadID := r.URL.Query().Get("uploadId") |
|
|
|
exists, err := s3a.exists(s3a.genUploadsFolder(bucket), uploadID, true) |
|
|
|
if !exists { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrNoSuchUpload, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchUpload) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
partIDString := r.URL.Query().Get("partNumber") |
|
|
|
partID, err := strconv.Atoi(partIDString) |
|
|
|
if err != nil { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidPart, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidPart) |
|
|
|
return |
|
|
|
} |
|
|
|
if partID > globalMaxPartID { |
|
|
|
s3err.WriteErrorResponse(w, s3err.ErrInvalidMaxParts, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidMaxParts) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -208,7 +208,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ |
|
|
|
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r) |
|
|
|
} |
|
|
|
if s3ErrCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, s3ErrCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, s3ErrCode) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -225,7 +225,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ |
|
|
|
|
|
|
|
etag, errCode := s3a.putToFiler(r, uploadUrl, dataReader) |
|
|
|
if errCode != s3err.ErrNone { |
|
|
|
s3err.WriteErrorResponse(w, errCode, r) |
|
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|