Skip to content

feat(httpsys): support chunked transfer-encoding - #35

Open
thy69 wants to merge 2 commits into
masterfrom
chunked-transfer-encoding
Open

feat(httpsys): support chunked transfer-encoding#35
thy69 wants to merge 2 commits into
masterfrom
chunked-transfer-encoding

Conversation

@thy69

@thy69 thy69 commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds support for Transfer-Encoding: chunked request bodies in THttpApi2Server (dwsHTTPSysServer.pas).

  • http.sys de-chunks request bodies natively; when the request is chunked (or has no Content-Length), the body is now read in 64 KB increments until ERROR_HANDLE_EOF instead of relying on Content-Length.
  • Bodies of unknown length are capped by MaxInputCountLength (default 100 MB) and rejected with 413 Payload Too Large beyond that, enforced cumulatively while reading.
  • The decompression path (Content-Encoding) is now shared by both read paths (known-length and chunked).
  • MaxInputCountLength is now propagated in Clone.

Refs QuBES #1333

🤖 Generated with Claude Code

http.sys de-chunks request bodies natively; read until
ERROR_HANDLE_EOF instead of relying on Content-Length. Bodies of
unknown length are capped by MaxInputCountLength (default 100 MB)
and rejected with 413 beyond that. Decompression path now shared
by both read paths. Propagate MaxInputCountLength in Clone.

Refs QuBES #1333
@thy69
thy69 requested a review from EricGrange August 19, 2026 13:17
@thy69
thy69 marked this pull request as draft August 19, 2026 13:36
- grow read buffer geometrically to avoid O(n^2) reallocations
- cancel request after 413 so the unread body cannot flood the
  connection
- cap decompressed size too: the wire cap only bounds compressed
  bytes, leaving decompression bombs unchecked
- hoist flags computation out of both read loops

Refs QuBES #1333
@thy69
thy69 marked this pull request as ready for review August 19, 2026 13:54
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