EntropyEngine::Networking::HTTP::StreamHandle
EntropyEngine::Networking::HTTP::StreamHandle
Section titled “EntropyEngine::Networking::HTTP::StreamHandle”Handle to active streaming HTTP request. More…
#include <HttpClient.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| bool | waitForHeaders(std::chrono::milliseconds timeout =std::chrono::milliseconds(30000)) Waits for headers to be received. |
| size_t | read(uint8_t * buffer, size_t size) Reads up to size bytes from stream. |
| bool | isDone() const Checks if stream has completed. |
| int | getStatusCode() const Gets HTTP status code (available after headers received). |
| HttpHeaderValuesMap | getHeadersMulti() const Gets multi-valued response headers (available after headers received). |
| HttpHeaders | getHeaders() const Gets response headers (available after headers received). |
| std::string | getFailureReason() const Gets failure reason if failed. |
| bool | failed() const Checks if stream failed. |
| void | cancel() Cancels the ongoing HTTP transfer. |
| StreamHandle(std::shared_ptr< StreamState > state) |
Friends
Section titled “Friends”| Name | |
|---|---|
| class | HttpClient |
Detailed Description
Section titled “Detailed Description”class EntropyEngine::Networking::HTTP::StreamHandle;Handle to active streaming HTTP request.
Provides incremental read access to response body. Use for large downloads where aggregated responses would exceed memory limits.
StreamOptions opts{.bufferBytes = 4 * 1024 * 1024};auto handle = client.executeStream(req, opts);std::vector<uint8_t> chunk(64 * 1024);while (!handle.isDone()) { size_t n = handle.read(chunk.data(), chunk.size()); processChunk(chunk.data(), n);}Public Functions Documentation
Section titled “Public Functions Documentation”function waitForHeaders
Section titled “function waitForHeaders”bool waitForHeaders( std::chrono::milliseconds timeout =std::chrono::milliseconds(30000))Waits for headers to be received.
Parameters:
- timeout Maximum time to wait
Return: true if headers ready, false on timeout
function read
Section titled “function read”size_t read( uint8_t * buffer, size_t size)Reads up to size bytes from stream.
Parameters:
- buffer Destination buffer
- size Maximum bytes to read
Return: Number of bytes actually read (0 if none available)
function isDone
Section titled “function isDone”bool isDone() constChecks if stream has completed.
Return: true if all data received and consumed
function getStatusCode
Section titled “function getStatusCode”int getStatusCode() constGets HTTP status code (available after headers received).
Return: Status code, or 0 if headers not yet ready
function getHeadersMulti
Section titled “function getHeadersMulti”HttpHeaderValuesMap getHeadersMulti() constGets multi-valued response headers (available after headers received).
Return: Map of header name to all values
function getHeaders
Section titled “function getHeaders”HttpHeaders getHeaders() constGets response headers (available after headers received).
Return: Headers map (lowercase keys)
function getFailureReason
Section titled “function getFailureReason”std::string getFailureReason() constGets failure reason if failed.
Return: Error message
function failed
Section titled “function failed”bool failed() constChecks if stream failed.
Return: true on error
function cancel
Section titled “function cancel”void cancel()Cancels the ongoing HTTP transfer.
Safe to call from any thread. Causes the transfer to abort promptly.
function StreamHandle
Section titled “function StreamHandle”inline explicit StreamHandle( std::shared_ptr< StreamState > state)Friends
Section titled “Friends”friend HttpClient
Section titled “friend HttpClient”friend class HttpClient( HttpClient);Updated on 2026-01-26 at 17:14:35 -0500