From 2da4bd5f1a5b6ddcf9f4ccbfd61e8376624bb006 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Mon, 24 Jul 2023 07:56:28 -0700 Subject: [PATCH] Revert "don't error when asked for 0-based range on empty objects (#17708) (#17713) Revert "don't error when asked for 0-based range on empty objects (#17708)" This reverts commit 7e76d66184ac219f30314d5cffc4d2ef62529fa7. There is no valid way to specify offsets in a 0-byte file. Blame it on the [RFC](https://datatracker.ietf.org/doc/html/rfc7233#section-4.4) > The 416 (Range Not Satisfiable) status code indicates that none of the ranges in the > request's Range header field (Section 3.1) overlap the current extent of the selected resource... A request for "bytes=0-" is a request for the first byte of a resource. If the resource is 0-length, the range [0,0] does not overlap the resource content and the server responds with an error. --- cmd/httprange.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/httprange.go b/cmd/httprange.go index ce91abb72..db2229905 100644 --- a/cmd/httprange.go +++ b/cmd/httprange.go @@ -59,9 +59,6 @@ func (h *HTTPRangeSpec) GetLength(resourceSize int64) (rangeLength int64, err er rangeLength = resourceSize } - case h.Start == 0 && resourceSize == 0: - rangeLength = resourceSize - case h.Start >= resourceSize: return 0, errInvalidRange