Skip to content

Commit

Permalink
s3proxy: handle Range header on GetObject
Browse files Browse the repository at this point in the history
We currently can't support the range header as we
have to parse it ourself, fetch the full file, decrypt it
and serve the requested slice.
For now, fail loudly to make users aware of the limitation.
AB#3466.
  • Loading branch information
derpsteb committed Sep 29, 2023
1 parent 8bbc9b6 commit 3984b5a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions s3proxy/internal/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ func (r Router) Serve(w http.ResponseWriter, req *http.Request) {
parts := strings.Split(req.Host, ".")
bucket := parts[0]

if req.Header.Get("Range") != "" {
r.log.Error("GetObject Range header unsupported")
http.Error(w, "s3proxy currently does not support Range headers", http.StatusNotImplemented)
}

obj := object{
client: client,
key: key,
Expand All @@ -82,6 +87,11 @@ func (r Router) Serve(w http.ResponseWriter, req *http.Request) {
}
h = get(obj.get)
case !containsBucket(req.Host) && match(path, "/([^/?]+)/(.+)", &bucket, &key) && req.Method == "GET" && !isGetObjectX(req.URL.Query()):
if req.Header.Get("Range") != "" {
r.log.Error("GetObject Range header unsupported")
http.Error(w, "s3proxy currently does not support Range headers", http.StatusNotImplemented)
}

obj := object{
client: client,
key: key,
Expand Down

0 comments on commit 3984b5a

Please sign in to comment.