Skip to content

Support chunked HTTP request uploads - #668

Open
bsergean wants to merge 1 commit into
masterfrom
feature/http-chunked-upload
Open

bsergean wants to merge 1 commit into
masterfrom
feature/http-chunked-upload

Conversation

@bsergean

Copy link
Copy Markdown
Collaborator

HTTP endpoints that require Transfer-Encoding: chunked could not receive uploads from HttpClient. An explicit extraHeaders["Transfer-Encoding"] = "chunked" now frames both string bodies and streamed upload callbacks. Callback uploads no longer need a known length in this mode: returning zero sends the terminating chunk, and exceptions report a source failure. Existing uploads keep their Content-Length behavior.

The implementation uses bounded data chunks, rejects conflicting Content-Length and unsupported transfer codings, preserves cancellation and connection reuse, and replays uploads on redirects. A 303 redirect clears the body and transfer header. No API fields or dependencies are added; library code remains C++11 compatible.

Documentation explains upload callbacks, response chunk callbacks, and asynchronous completion. Requests still finish uploading before reading responses; simultaneous bidirectional streaming is outside this change. The built-in HTTP server still only accepts Content-Length request bodies.

Validation:

  • Full OpenSSL regression suite: 37/37 passed.
  • HTTP/HTTPS upload tests: 672 assertions in 10 cases pass with OpenSSL, Network.framework, and mbedTLS 3.
  • No TLS/no zlib upload tests: 378 assertions passed.
  • Covers binary/empty bodies, unknown lengths, methods, redirects, cancellation/source errors, malformed framing, async response chunks, and connection reuse.
  • C++11 pedantic builds, Network.framework deprecated API warnings as errors, clang-format, and git diff checks pass. New cases have no deliberate waits.

Fixes #381.

This branch has not been deployed

No deployments
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.

HTTP Chunked Transfer-Encoding support

1 participant