Skip to content

Commit

Permalink
Do not send body on failed range request (#1884)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored Jul 13, 2021
1 parent f8b91e1 commit 0e9bd80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/no-body-on-failed-range.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Do not send body on failed range request

Instead of send the error in the body of a 416 response we log it. This prevents the go reverse proxy from choking on it and turning it into a 502 Bad Gateway response.

https://github.com/cs3org/reva/pull/1884
3 changes: 2 additions & 1 deletion pkg/rhttp/datatx/utils/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ func GetOrHeadFile(w http.ResponseWriter, r *http.Request, fs storage.FS) {
if err == ErrNoOverlap {
w.Header().Set("Content-Range", fmt.Sprintf("bytes */%d", md.Size))
}
sublog.Error().Err(err).Interface("md", md).Interface("ranges", ranges).Msg("range request not satisfiable")
w.WriteHeader(http.StatusRequestedRangeNotSatisfiable)
fmt.Fprintln(w, err)

return
}
if SumRangesSize(ranges) > int64(md.Size) {
Expand Down

0 comments on commit 0e9bd80

Please sign in to comment.