AXIAM C++ SDK 1.0.0-alpha8
Authentication, authorization, JWKS & route guards (REST + mTLS)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
axiam::CurlTransport Class Reference

Owns a POOL of libcurl easy handles (up to TlsConfig::max_concurrent_requests) whose cookie jar, DNS cache and TLS session cache are shared through a CURLSH, so one client instance keeps one session across requests while still performing them concurrently. More...

#include <http_curl.hpp>

Public Member Functions

 CurlTransport (TlsConfig cfg)
 
 ~CurlTransport ()
 
 CurlTransport (const CurlTransport &)=delete
 
CurlTransportoperator= (const CurlTransport &)=delete
 
HttpResponse perform (const HttpRequest &req)
 Perform one HTTP exchange.
 

Static Public Member Functions

static Transport make_transport (TlsConfig cfg)
 Build a Transport (std::function) that forwards to a shared CurlTransport, so the cookie engine and TLS material are shared for the client's lifetime.
 

Detailed Description

Owns a POOL of libcurl easy handles (up to TlsConfig::max_concurrent_requests) whose cookie jar, DNS cache and TLS session cache are shared through a CURLSH, so one client instance keeps one session across requests while still performing them concurrently.

This class owned exactly one handle behind a mutex until benchmark run 5 showed what that costs: check p50 3.2 ms against p95 280 ms, i.e. a tail made almost entirely of callers queueing for the lock rather than of anything on the wire. A pooled handle per in-flight request removes the queue; shared cookies keep ยง4's session semantics exactly as they were.

Each handle is long-lived so libcurl's connection cache keeps its TCP+TLS connection hot. Keep-alive is not optional: CURLOPT_FORBID_REUSE and CURLOPT_FRESH_CONNECT are pinned off, connection age-based retirement is disabled, and Expect: 100-continue is suppressed so a large POST body never waits on an interim response. See the comments in src/http_curl.cpp for why each of those defaults produced a latency tail.

Constructor & Destructor Documentation

◆ CurlTransport() [1/2]

axiam::CurlTransport::CurlTransport ( TlsConfig  cfg)
explicit

◆ ~CurlTransport()

axiam::CurlTransport::~CurlTransport ( )

◆ CurlTransport() [2/2]

axiam::CurlTransport::CurlTransport ( const CurlTransport )
delete

Member Function Documentation

◆ operator=()

CurlTransport & axiam::CurlTransport::operator= ( const CurlTransport )
delete

◆ perform()

HttpResponse axiam::CurlTransport::perform ( const HttpRequest req)

Perform one HTTP exchange.

On connection/DNS/TLS failure the returned HttpResponse has a non-empty transport_error and status 0.

◆ make_transport()

static Transport axiam::CurlTransport::make_transport ( TlsConfig  cfg)
static

Build a Transport (std::function) that forwards to a shared CurlTransport, so the cookie engine and TLS material are shared for the client's lifetime.


The documentation for this class was generated from the following file: