aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-06-08 01:45:40 -0700
committerGitHub <noreply@github.com>2022-06-08 01:45:40 -0700
commit4a5135961f71fa3b9a3b9b9267cf20e92372a8ec (patch)
tree2eda39edfd87123da43e143d64f87744606d023b
parent8a1166c02145b8752a8c5f3d30a3451ff26f2865 (diff)
parent49f058da85c046381555622c889b08420ac14cbb (diff)
downloadseaweedfs-4a5135961f71fa3b9a3b9b9267cf20e92372a8ec.tar.xz
seaweedfs-4a5135961f71fa3b9a3b9b9267cf20e92372a8ec.zip
Merge pull request #3154 from kmlebedev/s3_test_invalid_range
-rw-r--r--weed/s3api/s3api_object_handlers.go5
-rw-r--r--weed/s3api/s3err/s3api_errors.go6
2 files changed, 11 insertions, 0 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index 84ed1c92b..4ad3454ba 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -353,6 +353,11 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des
return
}
+ if resp.StatusCode == http.StatusRequestedRangeNotSatisfiable {
+ s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRange)
+ return
+ }
+
if (resp.ContentLength == -1 || resp.StatusCode == 404) && resp.StatusCode != 304 {
if r.Method != "DELETE" {
s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchKey)
diff --git a/weed/s3api/s3err/s3api_errors.go b/weed/s3api/s3err/s3api_errors.go
index 52803f398..2e93f49cb 100644
--- a/weed/s3api/s3err/s3api_errors.go
+++ b/weed/s3api/s3err/s3api_errors.go
@@ -64,6 +64,7 @@ const (
ErrInvalidMaxDeleteObjects
ErrInvalidPartNumberMarker
ErrInvalidPart
+ ErrInvalidRange
ErrInternalError
ErrInvalidCopyDest
ErrInvalidCopySource
@@ -370,6 +371,11 @@ var errorCodeResponse = map[ErrorCode]APIError{
Description: "Invalid Request",
HTTPStatusCode: http.StatusBadRequest,
},
+ ErrInvalidRange: {
+ Code: "InvalidRange",
+ Description: "The requested range is not satisfiable",
+ HTTPStatusCode: http.StatusRequestedRangeNotSatisfiable,
+ },
ErrAuthNotSetup: {
Code: "InvalidRequest",
Description: "Signed request requires setting up SeaweedFS S3 authentication",