Skip to content

EntropyEngine::Networking::HTTP::HttpClient

EntropyEngine::Networking::HTTP::HttpClient

Section titled “EntropyEngine::Networking::HTTP::HttpClient”

Production-grade HTTP client using libcurl. More…

#include <HttpClient.h>

Name
~HttpClient()
Destructor - cleans up libcurl resources.
voidsetUseSystemProxy(bool enabled)
Programmatic opt-out for system proxy fallback (default: enabled).
HttpClient &operator=(const HttpClient & ) =delete
HttpClient &operator=(HttpClient && ) =delete
StreamHandleexecuteStream(const HttpRequest & req, const StreamOptions & opts ={})
Execute streaming HTTP request for large downloads.
HttpResponseexecute(const HttpRequest & req, const RequestOptions & opts ={})
Execute HTTP request synchronously (blocks calling thread).
voidcloseIdle()
Close all idle connections.
HttpClient()
Constructs HTTP client with libcurl backend.
HttpClient(const HttpClient & ) =delete
HttpClient(HttpClient && ) =delete
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);
}
~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.

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().

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

void closeIdle()

Close all idle connections.

Useful for cleanup or forcing connection refresh.

HttpClient()

Constructs HTTP client with libcurl backend.

HttpClient(
const HttpClient &
) =delete
HttpClient(
HttpClient &&
) =delete

Updated on 2026-01-26 at 16:50:32 -0500