From 3984b5a7a4eab4774580c07d3ca828a670247841 Mon Sep 17 00:00:00 2001 From: Otto Bittner Date: Fri, 29 Sep 2023 10:01:09 +0200 Subject: [PATCH] s3proxy: handle Range header on GetObject 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. --- s3proxy/internal/router/router.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/s3proxy/internal/router/router.go b/s3proxy/internal/router/router.go index 443f13dea0a..772a4a962ad 100644 --- a/s3proxy/internal/router/router.go +++ b/s3proxy/internal/router/router.go @@ -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, @@ -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,