Skip to content

http1: scan request-target in on_url (single pass, follow-up to #57)#58

Merged
EdmondDantes merged 1 commit into
mainfrom
refactor-uri-target-check-to-on-url
May 29, 2026
Merged

http1: scan request-target in on_url (single pass, follow-up to #57)#58
EdmondDantes merged 1 commit into
mainfrom
refactor-uri-target-check-to-on-url

Conversation

@EdmondDantes
Copy link
Copy Markdown
Contributor

Pure refactor of the #57 fragment/backslash check — no behaviour change.

Moves the '#'/'\' request-target rejection from on_headers_complete (which re-scanned the fully-assembled URI — a second pass) into on_url, where llhttp already iterates those bytes while accumulating the target. Result: single pass, rejects earlier (mid request-line, before headers are parsed), and sits next to the existing URI-size check in the same callback.

Safe across chunk boundaries — #/\ are single bytes, can't be split. h1/021 + full tests/phpt 203/203.

…ass)

Follow-up to #57: move the '#'/'\' request-target rejection from
on_headers_complete (a second full scan of the assembled URI) into on_url,
where llhttp already passes over those bytes as it accumulates the target.
Single pass, rejects earlier (mid-request-line, before headers), and
mirrors the existing URI-size check in the same callback. Both are single
byte values so a chunk boundary can't split them. Behaviour identical —
h1/021 + full tests/phpt 203/203.
@github-actions
Copy link
Copy Markdown
Contributor

Coverage

Total lines: 80.70% → 80.69% (-0.00 pp)

File Baseline Current Δ Touched
src/http1/http_parser.c 83.27% 83.17% -0.10 pp

@EdmondDantes EdmondDantes merged commit 068f536 into main May 29, 2026
8 checks passed
@EdmondDantes EdmondDantes deleted the refactor-uri-target-check-to-on-url branch May 29, 2026 19:50
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