http1: reject fragment/backslash in target + duplicate Content-Type (#47 hardening)#57
Merged
Merged
Conversation
) Optional RFC hardening of the request-target and singleton headers — all were Warn in Http11Probe (200 accepted) but stricter rejection closes real path-confusion / framing-ambiguity vectors: - raw '#' in the request-target (fragment, never sent per RFC 9112 §3.2) → 400 - raw '\' in the request-target (not a URI char, RFC 3986; '\' vs '/' parsed inconsistently) → 400 - duplicate Content-Type (RFC 9110 §8.3 singleton) → 400 (new ct_seen_count) Percent-encoded %23 / %5C stay legal. New h1/021. Re-ran the WHOLE tests/phpt (202/202) — lesson from the version→505 misfire: validate the full set after a parser change, not one case. Multi-space request-line is NOT done: llhttp consumes the spaces before our callbacks, so it's not detectable post-parse without llhttp leniency changes.
Contributor
CoverageTotal lines: 80.78% → 80.82% (+0.04 pp)
|
6 tasks
EdmondDantes
added a commit
that referenced
this pull request
May 29, 2026
…n-url http1: scan request-target in on_url (single pass, follow-up to #57)
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.
Finishes the optional #47 hardening — three request checks that Http11Probe flagged as Warn (200 accepted) but where stricter 400 closes real ambiguity vectors:
#in request-target (fragment — never sent on the wire, RFC 9112 §3.2) → 400\in request-target (not a URI char, RFC 3986;\↔/parsed inconsistently → path confusion) → 400Content-Type(RFC 9110 §8.3 singleton) → 400 (ct_seen_count)Percent-encoded
%23/%5Cstay legal (200). Newh1/021-request-target-hardening. Fulltests/phpt202/202 (validated the whole set, per the version→505 lesson).Not done — multi-space request-line: llhttp consumes the request-line spacing before our callbacks fire, so it's not detectable post-parse without llhttp-leniency changes (deliberately avoided). That single Warn stays; it's RFC-Should, 200 acceptable.