{{ message }}
Repository navigation
[PR #13246/25561d97 backport][3.15] Strip trailing OWS from header values in the C parser - #13248
Merged
Dreamsorcerer merged 1 commit intoJul 26, 2026
Conversation
(cherry picked from commit 25561d9)
4 of 5 tasks
Dreamsorcerer
deleted the
patchback/backports/3.15/25561d975a7a9e10eec3b381bc769737b57b3c9b/pr-13246
branch
July 26, 2026 21:48
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.

This is a backport of PR #13246 as merged into master (25561d9).
What do these changes do?
llhttp strips the OWS before a header value but leaves the OWS after it, and
_process_header()decodes the raw bytes as-is. So the C parser keeps trailing spaces and tabs where the Python parser strips them:RFC 9110 section 5.5 says the OWS on both sides is excluded from the field value, and
HeadersParser.parse_headers()already doesbvalue.strip(b" \t")for bothheadersandraw_headers(there is a comment there saying raw does not mean the OWS is kept). This does the same in the C parser.test_http_request_parser_utf8_request_linecovers this for the Python parser, but it is xfailed for the C parser over an unrelated URL difference, so the gap was not visible.Are there changes in behavior for the user?
Header values read through the C parser no longer carry trailing spaces or tabs, so both parsers now return the same thing.
raw_headerschanges the same way.Is it a substantial burden for the maintainers to support this?
No, it is three lines in
_process_header()and removes a difference between the two parsers.Related issue number
None.
Checklist
CONTRIBUTORS.txtCHANGES/folderTest run
Built with the Cython extensions (
make generate-llhttp,make cythonize,pip install -e .).New test, both parsers:
Same test against master, to check it catches the bug:
Parser suite and full suite:
The 15 failures are all
tests/test_run_app.py,OSError: [Errno 48] address already in useon port 8080 on this machine. They fail the same way on master (4930 passed there, the +2 here is the new test).Drafted with Claude Opus 5 (Claude Code); reviewed by @LuShadowX.