mirror of
https://github.com/minio/minio.git
synced 2025-01-24 05:03:16 -05:00
don't error when asked for 0-based range on empty objects (#17708)
In a reverse proxying setup, a proxy in front of MinIO may attempt to request objects in slices for enhanced cache efficiency. Since such a a proxy cannot have prior knowledge of how large a requested resource is, it usually sends a header of the form: Range: 0-$slice_size ... and, depending on the size of the resource, expects either: - an empty response, if $resource_size == 0 - a full response, if $resource_size <= $slice_size - a partial response, if $resource_size > $slice_size Prior to this change, MinIO would respond 416 Range Not Satisfiable if a client tried to request a range on an empty resource. This behavior is technically consistent with RFC9110[1] – However, it renders sliced reverse proxying, such as implemented in Nginx, broken in the case of empty files. Nginx itself seems to break this convention to enable "useful" responses in these cases, and MinIO should probably do that too. [1]: https://www.rfc-editor.org/rfc/rfc9110#byte.ranges
This commit is contained in:
parent
7764f4a8e3
commit
7e76d66184
@ -59,6 +59,9 @@ func (h *HTTPRangeSpec) GetLength(resourceSize int64) (rangeLength int64, err er
|
|||||||
rangeLength = resourceSize
|
rangeLength = resourceSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case h.Start == 0 && resourceSize == 0:
|
||||||
|
rangeLength = resourceSize
|
||||||
|
|
||||||
case h.Start >= resourceSize:
|
case h.Start >= resourceSize:
|
||||||
return 0, errInvalidRange
|
return 0, errInvalidRange
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user