Skip to content

Fix rfc7233 non compliances#2

Merged
manuelpelloni merged 4 commits intoM4SS-Code:mainfrom
mi-caren:fix-rfc7233-non-compliances
Mar 12, 2026
Merged

Fix rfc7233 non compliances#2
manuelpelloni merged 4 commits intoM4SS-Code:mainfrom
mi-caren:fix-rfc7233-non-compliances

Conversation

@mi-caren
Copy link
Copy Markdown
Member

No description provided.

@mi-caren mi-caren force-pushed the fix-rfc7233-non-compliances branch from 9f18018 to a1d39b1 Compare March 11, 2026 14:44
Comment thread src/lib.rs
RFC 7233 Section 2.1 states that if the last-byte-pos is greater than
or equal to the current length of the representation, the byte range
should be interpreted as the remainder of the representation, not
rejected as unsatisfiable.

`bytes=0-999` on a 500-byte file now returns `bytes 0-499/500` (206)
instead of 416.
RFC 7233 Section 2.1 states that if the selected representation is
shorter than the specified suffix-length, the entire representation
is used.

`bytes=-999` on a 500-byte file now returns `bytes 0-499/500` (206)
instead of 416.
With suffix clamping, a non-zero suffix is always satisfiable
regardless of file size. The only unsatisfiable suffix is `Suffix(0)`.

Previously `Suffix(0)` against `Unsatisfiable` incorrectly returned
`false` because `0 > size` is never true.
After clamping range ends and suffixes to file size, the response
range can be shorter than what was originally requested. Relax the
equality checks to accept clamped responses:

- `Range`: accept response end <= requested end
- `Suffix`: accept response length <= requested suffix

Add tests for suffix edge cases: response not ending at file
boundary, and response length exceeding the requested suffix.
@mi-caren mi-caren force-pushed the fix-rfc7233-non-compliances branch from a1d39b1 to ceeddfd Compare March 12, 2026 10:13
@manuelpelloni manuelpelloni merged commit 3329d56 into M4SS-Code:main Mar 12, 2026
8 checks passed
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.

3 participants