Repository navigation
Only accept a chunk size at the start of the chunk-size line - #364
Merged
Merged
Conversation
shioimm
approved these changes
Nov 24, 2026
shioimm
left a comment
Contributor
There was a problem hiding this comment.
LGTM overall.
This regex still accepts trailing spaces after the chunk size (e.g. "1f ").
This is not in the RFC grammar, but some other implementations accept it (e.g. CPython's http.client does rstrip() in _read_next_chunk_size: https://github.com/python/cpython/blob/main/Lib/http/client.py ).
If we reject it, we might break interop if there are servers that send trailing spaces. So I think it is fine to leave it as it is.
nit: line[/.../] and line.slice(/.../) do the same thing. Using .slice like the original code makes the diff smaller. But either is fine.
read_chunked took the first run of hex digits anywhere in the line, so lines such as "0x1f" or ";ext=1f" were read as different sizes. Require the size at the start of the line, followed only by optional whitespace and a chunk extension, as RFC 9112 does. Co-authored-by: Clément Joubert (https://hackerone.com/czjfr) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mame
force-pushed
the
chunk-size-line
branch
from
November 25, 2026 13:29
b66abb6 to
b13fdd7
Compare
Member
Author
|
Thank you for looking into other implementations too! I changed it to use |
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.
read_chunked took the first run of hex digits anywhere in the line, so lines such as "0x1f" or ";ext=1f" were read as different sizes. Require the size at the start of the line, followed only by optional whitespace and a chunk extension, as RFC 9112 does.
Co-authored-by: Clément Joubert (https://hackerone.com/czjfr)