Skip to content

Fix Range: bytes=0-0 returning the whole entity - #1681

Open
azaklika wants to merge 1 commit into
sabre-io:masterfrom
azaklika:master
Open

azaklika wants to merge 1 commit into
sabre-io:masterfrom
azaklika:master

Conversation

@azaklika

Copy link
Copy Markdown

Fix Range: bytes=0-0 returning the whole entity

getHTTPRange() correctly parses "bytes=0-0" as [0, 0], but CorePlugin::httpGet()
computes the end offset with a truthiness check ($range[1] ?: $nodeSize - 1).
Since (int) 0 is falsy, a request for the first byte is treated as an open-ended
range and the server responds with 206, Content-Range: bytes 0-/
and the full body.

RFC 7233 §2.1 allows first-byte-pos and last-byte-pos to both be 0.

Impact: CDNs and download managers probe object size with "Range: bytes=0-0"
(e.g. Akamai partial object caching) and fail on the mismatched Content-Range,
which breaks delivery of large files behind sabre/dav-based servers such as Nextcloud.

Includes a regression test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant