Fix rfc7233 non compliances#2
Merged
manuelpelloni merged 4 commits intoM4SS-Code:mainfrom Mar 12, 2026
Merged
Conversation
9f18018 to
a1d39b1
Compare
paolobarbolini
approved these changes
Mar 11, 2026
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.
a1d39b1 to
ceeddfd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.