EntropyEngine::Networking::HTTP::HttpClient
EntropyEngine::Networking::HTTP::HttpClient
Section titled “EntropyEngine::Networking::HTTP::HttpClient”Production-grade HTTP client using libcurl. More…
#include <HttpClient.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| ~HttpClient() Destructor - cleans up libcurl resources. | |
| void | setUseSystemProxy(bool enabled) Programmatic opt-out for system proxy fallback (default: enabled). |
| HttpClient & | operator=(const HttpClient & ) =delete |
| HttpClient & | operator=(HttpClient && ) =delete |
| StreamHandle | executeStream(const HttpRequest & req, const StreamOptions & opts ={}) Execute streaming HTTP request for large downloads. |
| HttpResponse | execute(const HttpRequest & req, const RequestOptions & opts ={}) Execute HTTP request synchronously (blocks calling thread). |
| void | closeIdle() Close all idle connections. |
| HttpClient() Constructs HTTP client with libcurl backend. | |
| HttpClient(const HttpClient & ) =delete | |
| HttpClient(HttpClient && ) =delete |
Detailed Description
Section titled “Detailed Description”class EntropyEngine::Networking::HTTP::HttpClient;Production-grade HTTP client using libcurl.
Provides HTTP/1.1 and HTTP/2 support with automatic protocol negotiation (ALPN). Thread-safe connection pooling and multiplexing handled by libcurl.
Features:
- HTTP/1.1 and HTTP/2 with automatic fallback
- TLS with OpenSSL/SChannel
- DNS hostname resolution
- Connection pooling and multiplexing
- Proxy support (env vars: HTTP_PROXY, HTTPS_PROXY, NO_PROXY)
- Timeouts and safety limits
- Streaming downloads with backpressure
HttpClient client;HttpRequest req{.method = HttpMethod::GET, .host = "example.com", .path = "/api/data"};HttpResponse resp = client.execute(req);if (resp.isSuccess()) { processData(resp.body);}Public Functions Documentation
Section titled “Public Functions Documentation”function ~HttpClient
Section titled “function ~HttpClient”~HttpClient()Destructor - cleans up libcurl resources.
function setUseSystemProxy
Section titled “function setUseSystemProxy”void setUseSystemProxy( bool enabled)Programmatic opt-out for system proxy fallback (default: enabled).
function operator=
Section titled “function operator=”HttpClient & operator=( const HttpClient &) =deletefunction operator=
Section titled “function operator=”HttpClient & operator=( HttpClient &&) =deletefunction executeStream
Section titled “function executeStream”StreamHandle executeStream( const HttpRequest & req, const StreamOptions & opts ={})Execute streaming HTTP request for large downloads.
Parameters:
- req HTTP request (typically GET)
- opts Streaming options (buffer size, limits, timeouts)
Return: StreamHandle for incremental reading
Returns immediately with StreamHandle. curl_easy_perform runs in background thread. Consumer reads incrementally via StreamHandle::read().
function execute
Section titled “function execute”HttpResponse execute( const HttpRequest & req, const RequestOptions & opts ={})Execute HTTP request synchronously (blocks calling thread).
Parameters:
- req HTTP request (method, host, path, headers, body)
- opts Request options (timeouts, max response size, etc.)
Return: HttpResponse with status code, headers, and body
function closeIdle
Section titled “function closeIdle”void closeIdle()Close all idle connections.
Useful for cleanup or forcing connection refresh.
function HttpClient
Section titled “function HttpClient”HttpClient()Constructs HTTP client with libcurl backend.
function HttpClient
Section titled “function HttpClient”HttpClient( const HttpClient &) =deletefunction HttpClient
Section titled “function HttpClient”HttpClient( HttpClient &&) =deleteUpdated on 2026-01-26 at 16:50:32 -0500