Skip to content

Commit 00a73d0

Browse files
authored
HTTP Client Chunked Support (#2414)
* HTTP Client Chunked Support * fix order * Update http-client.md
1 parent 9d0e244 commit 00a73d0

File tree

5 files changed

+1741
-50
lines changed

5 files changed

+1741
-50
lines changed

docs/networking/http-client.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ int main() {
3333
## Features
3434

3535
- **Connection Pooling**: Automatically reuses connections for better performance
36+
- **Chunked Transfer-Encoding**: Transparent decoding of chunked responses across synchronous, asynchronous, and streaming paths
3637
- **Asynchronous Operations**: Non-blocking requests with futures or completion handlers
3738
- **JSON Support**: Built-in JSON serialization for POST requests
3839
- **Thread-Safe**: Multiple threads can safely use the same client instance
@@ -445,6 +446,16 @@ if (url_parts) {
445446
}
446447
```
447448

449+
## Chunked Transfer-Encoding
450+
451+
Responses using `Transfer-Encoding: chunked` are automatically decoded. This is transparent to the caller -- `response_body` contains the fully assembled body regardless of whether the server used `Content-Length` or chunked encoding.
452+
453+
- Chunk extensions (`;key=value`) are ignored per RFC 7230
454+
- Trailer headers after the terminal chunk are consumed and discarded
455+
- Malformed chunk sizes return a `protocol_error`
456+
457+
For streaming requests (`stream_request_v2`), chunked data is delivered incrementally via the `on_data` callback as each chunk arrives.
458+
448459
## Performance Notes
449460

450461
- The client automatically pools connections for better performance when making multiple requests to the same host

0 commit comments

Comments
 (0)