Skip to content

Commit f609a6d

Browse files
bajtosCopilot
andauthored
docs: empty range request
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 82aac4f commit f609a6d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ func serveRange(w http.ResponseWriter, f *os.File, size int64, u fee.RecipientUn
279279

280280
// Len is the requested length clamped to the object; Size is the whole
281281
// object's plaintext size. Both are known before any ciphertext is read.
282+
if r.Len() == 0 {
283+
w.Header().Set("Content-Range", fmt.Sprintf("bytes */%d", r.Size()))
284+
w.WriteHeader(http.StatusRequestedRangeNotSatisfiable)
285+
return nil
286+
}
282287
w.Header().Set("Content-Length", strconv.FormatInt(r.Len(), 10))
283288
w.Header().Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", off, off+r.Len()-1, r.Size()))
284289
w.WriteHeader(http.StatusPartialContent)

0 commit comments

Comments
 (0)