Skip to content

feat: incremental request parser (smuggling-prone rejections) - #6

Merged
AgentDudu merged 1 commit into
developfrom
feature/request-parser
Oct 20, 2026
Merged

AgentDudu merged 1 commit into
developfrom
feature/request-parser

Conversation

@AgentDudu

Copy link
Copy Markdown
Owner

What

  • http::RequestParser: push parser (feed → next → reset), buffer-owning, pipelining-safe.
  • Limits: maxHeadBytes (64K), maxBodyBytes (8M), maxHeaderCount (100) — CL rejected at header time, before body bytes arrive.
  • Rejections per plan invariants: bare-LF endings, obs-fold, duplicate Content-Length, CL+TE together, TE (chunked bodies deferred), no-colon lines, non-token method/name chars, non-digit CL, versions ≠ 1.0/1.1.
  • keepAlive(): comma-list Connection header; close wins; 1.0 needs explicit keep-alive.
  • 22 test cases / ~157 assertions incl. byte-at-a-time feed, pipelined buffer, limit boundaries.

Why now

Reactor (R) consumes exactly this interface; parser lands first so R stays reviewable.

Tests

  • Windows ck.ps1: all passed (23 cases).
  • Linux container ASan+UBSan + leak check: green.
  • Note: clang-format not installed on this host — format gate self-skips (pre-existing).

Push-style parser owning its buffer: feed()/next()/reset() keep-alive with pipelining, byte-exact across split feeds. Enforces maxHeadBytes/maxBodyBytes/maxHeaderCount before consuming bodies. Rejections: bare-LF line endings, obsolete folding, header line without colon, duplicate Content-Length, Content-Length with Transfer-Encoding, non-token method/name chars, non-digit CL, non-1.0/1.1 versions. keepAlive() token-list aware; close wins.

Traps found while testing: explicit ctor + '= {}' default arg is ill-formed (copy-list-init); head-size guard must only fire while the terminator is still missing or body bytes falsely trip it.
@AgentDudu
AgentDudu merged commit 8668203 into develop Oct 20, 2026
2 checks passed
@AgentDudu
AgentDudu deleted the feature/request-parser branch October 20, 2026 08:40
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