Skip to content

Migrate HTTP parser to llhttp - #1

Open
boytm wants to merge 2 commits into
privatefrom
migrate-to-llhttp-7920318541423995677
Open

boytm wants to merge 2 commits into
privatefrom
migrate-to-llhttp-7920318541423995677

Conversation

@boytm

@boytm boytm commented Feb 28, 2026

Copy link
Copy Markdown
Owner

This change replaces the old Node.js http-parser based implementation in htparse.c with a modern wrapper around llhttp v9.3.1. The existing htparser API is preserved to minimize changes in evhtp.c, while gaining the performance and security benefits of llhttp. Basic URL parsing is implemented to maintain support for component-specific hooks.


PR created automatically by Jules for task 7920318541423995677 started by @boytm

- Integrated llhttp source files (llhttp.h, llhttp.c, llhttp_api.c, llhttp_http.c) from the official v9.3.1 release.
- Reimplemented htparse.c to wrap llhttp while maintaining the existing htparser interface for compatibility with evhtp.c.
- Implemented granular URL parsing within the on_url callback to support legacy hooks (scheme, host, port, path, args).
- Added multipart detection logic to match previous behavior.
- Updated CMakeLists.txt to include the new llhttp source files.
- Verified the migration using test_htparse.

Co-authored-by: boytm <5652342+boytm@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Integrated official llhttp v9.3.1 source files.
- Reimplemented htparse.c to wrap llhttp while maintaining legacy htparser API.
- Added granular URL parsing in on_url callback for backward compatibility.
- Implemented multipart detection.
- Added examples/test_parser.c with automated test cases.
- Updated build system (CMakeLists.txt) to include new sources and test target.
- Verified with test_htparse and new test_parser.

Co-authored-by: boytm <5652342+boytm@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant