You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: replace deprecated http-parser with llhttp (#331)
Node's http-parser (vendored at v2.9.4) is deprecated and frozen. Its
maintained successor is llhttp, which is ~2x faster and keeps the same
incremental, callback-based parsing model.
To avoid pulling Node/npm/llparse into the build, we vendor llhttp's
*pre-generated* C release artifacts (the `release` branch of nodejs/llhttp,
tag release/v9.4.2): include/llhttp.h plus src/{llhttp,api,http}.c. These
compile with the normal C toolchain, so the build toolchain is unchanged.
- thirdparty: drop the http-parser git submodule, vendor llhttp sources,
and compile the three release .c files into dist/ (see VENDOR.md).
- http_parser_settings: port callbacks to the llhttp_t / llhttp_settings_t
API (llhttp_settings_init, settings bound at init). The signatures are
otherwise identical.
- on_headers_complete: http-parser's "return 2" (skip body) maps to llhttp's
"return 1"; on_message_complete now returns HPE_PAUSED so the parser stops
cleanly after one message instead of parsing trailing bytes as a pipelined
request (which would re-enter on_message_begin and trip its asserts). This
matches http-parser, which returned immediately after firing
on_message_complete for our requests.
- http_session: llhttp_execute returns an errno rather than a byte count;
derive bytes-consumed from the buffer length (HPE_OK) or llhttp_get_error_pos
(HPE_PAUSED / HPE_PAUSED_UPGRADE).
- .vscode: repoint include paths/associations at the new llhttp sources.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments