feat: http parse optimisation #188

Merged
bagas merged 7 commits from parse-optimisation into main 2026-11-09 23:25:00 +07:00
Owner
No description provided.
bagas added 7 commits 2026-11-09 23:18:48 +07:00
Header lines are parsed in one place, start lines are split out, and
malformed fields (obs-fold, bad tokens, control bytes) are refused before
anything is forwarded. Request reads pass non-HTTP bytes through verbatim.
A block's field count is bounded by the caller's header-size limit, and a
line without a colon is refused anyway. The fixed 64-field count only cut
off legitimate responses with many Set-Cookie lines.
Read never returns more than the caller's buffer and carries the rest, so a
full 32 KB read can no longer panic io.Copy or drop body bytes. The request
and response directions no longer share one buffer, where a short read could
truncate a half-received response, and response header buffering is capped.
The header parser keeps repeated fields, so Set alone left a spoofed value
next to the real one. Remove the header before setting it.
ci: run the test suite with the race detector
Tests / Run Tests (pull_request) Successful in 3m43s
5b300fce4c
bagas merged commit fb5edc8c40 into main 2026-11-09 23:25:00 +07:00
bagas deleted branch parse-optimisation 2026-11-09 23:25:03 +07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bagas/tunnel-please#188