Repository navigation
[bot] Use llhttp's HTTP_ALL_METHOD_COUNT for the method table - #14584
Dreamsorcerer wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #14584 +/- ##
=======================================
Coverage 99.13% 99.13%
=======================================
Files 135 135
Lines 54630 54631 +1
Branches 2808 2808
=======================================
+ Hits 54158 54159 +1
Misses 357 357
Partials 115 115
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Vizonex
left a comment
There was a problem hiding this comment.
I think this approach is a lot better executed. Glad llhttp made these changes to begin with.
This is from an agent via my MCP server, a human will verify it soon.
What do these changes do?
nodejs/llhttp#872 is resolved in llhttp 9.5.0, which master vendors since #14581:
llhttp.hnow definesHTTP_ALL_METHOD_COUNT, andllhttp_method_name()returnsNULLfor an unknown id instead of callingabort().That makes the inline C block from #13174, which rebuilt the name table from
HTTP_ALL_METHOD_MAP, unnecessary. This goes back to a plain loop overllhttp_method_name(), bounded by llhttp's count instead of the hardcoded 46 it used before #13174.A
NULLname is stored asNone. llhttp has none today (ids 0-46 are all assigned) and the parser never reports an id it has no method for. The old table failed the import with anAssertionErrorin that case.Are there changes in behavior for the user?
No. The table holds the same 47 names.
For downstreams: building with
AIOHTTP_USE_SYSTEM_DEPSnow needs llhttp 9.5.0 or newer. Against an older one the build stops with'HTTP_ALL_METHOD_COUNT' undeclared.Is it a substantial burden for the maintainers to support this?
No, it removes code. New llhttp methods are still picked up without a change here.
Related issue number
nodejs/llhttp#872, implemented upstream in nodejs/llhttp#880. Follows #13174. A backport needs llhttp 9.5.0 on that branch first (#14582, #14583).
Checklist
test_parse_query_methodcovers the highest method id; nothing new to test)CONTRIBUTORS.txt(N/A)CHANGES/folderLocal verification
-Werror) with the vendored llhttp 9.5.0:tests/test_http_parser.pygives 1363 passed, 3 xfailed on 3.13 (same as master) and on 3.11. Full suite on 3.13 with C extensions: 6056 passed, 25 skipped, 17 xfailed.llhttp_method_name()returns the same string as the old table for all 47 ids, andNULLfor 47. A request line for each of the 47 names gives the same result from the C parser as on master: 35 decode to llhttp's name (includingM-SEARCHandQUERY), and llhttp rejects the 12 RTSP / HTTP/2 ones.NULLnames, forced by patching a copy ofllhttp.h(FLUSH, id 45, dropped fromHTTP_ALL_METHOD_MAP; orHTTP_ALL_METHOD_COUNTraised to 50): the module imports andQUERYstill decodes. With the same gap master raisesAssertionErroron import, or segfaults underpython -O.AIOHTTP_USE_SYSTEM_DEPS=1against a shared llhttp 9.5.0 (CMake build,libllhttp.so.9.5): builds, and the parser tests pass. Against llhttp 9.4.4 the build fails with the error above.