🟥 Streaming-first HTTP client with native OS backends
SaneCppHttpClient.h is a streaming-first HTTP client built on native OS backends.
HttpClientAsyncT adapter for AsyncStreamsSC::HttpClientAsyncT🟥 Draft
The API is stabilizing and the streaming core is in place, but consider everything HIGHLY experimental.
HttpClient is designed to stay allocation-free by relying on caller-provided buffers and queues. The core library is poll-driven and independent from Async, AsyncStreams, Threading, and Time. Response headers are written into a user-provided buffer, while response body chunks are delivered during poll() through a small listener interface.
Request bodies can be passed as a fixed span or streamed by implementing a pull-based provider with an explicit Content-Length. For stream-first integration there is a separate SC::HttpClientAsyncT<T_AsyncEventLoop, T_AsyncStreams> adapter that translates the same core operation into AsyncReadableStream and AsyncWritableStream.
Current limitations:
SC::HttpClientReusable HTTP backend/session owner.
Configuration for an outgoing HTTP request.
Parsed response metadata filled when headers arrive.
Pull-based provider for streamed request bodies.
Listener receiving response notifications during HttpClientOperation::poll.
Optional notifier used by external adapters to wake up their own event loop.
Caller-owned response buffer descriptor for one HttpClientOperation.
Event slot storage used by HttpClientOperation to hand off backend notifications.
Caller-owned memory for one HttpClientOperation.
One in-flight HTTP request/response operation.
SC::HttpClientAsyncT and SC::HttpClientAsyncOperationMemoryT are declared in Libraries/HttpClient/HttpClientAsync.h.
They provide the optional Async / AsyncStreams integration layer on top of the poll-driven HttpClientOperation core, reusing the same request, response, and caller-owned operation memory model.
With the standard Async Streams library, instantiate the adapter as SC::HttpClientAsyncT<SC::AsyncEventLoop, SC::AsyncStreams> and the adapter memory as SC::HttpClientAsyncOperationMemoryT<SC::AsyncStreams>.
Some relevant blog posts are:
Tests/Libraries/HttpClient show blocking and async usage patternsAsyncReadableStream🟨 MVP
🟩 Usable Features:
🟦 Complete Features:
💡 Unplanned Features:
| Type | Lines Of Code | Comments | Sum |
|---|---|---|---|
| Headers | 664 | 229 | 893 |
| Sources | 2090 | 335 | 2425 |
| Sum | 2754 | 564 | 3318 |