pub struct HttpClientConfig {
pub implementation: HttpImpl,
pub driver: Config,
pub pool: usize,
pub request_timeout_ms: u32,
pub buf_size: usize,
pub background_connect: bool,
pub curl_drive: CurlDrive,
pub curl_ca_file: Option<String>,
pub curl_allow_non_idempotent_methods: bool,
pub connect_gate: bool,
pub reconnect_seed: u64,
}Expand description
HttpClient settings.
Fields§
§implementation: HttpImplThe implementation.
driver: ConfigNative: the loop backend for the pool’s driver. Both implementations
take TCP keepalive, TCP_USER_TIMEOUT and the quick-ACK route check’s
policy from it (driver.quickack_check, see crate::route):
libcurl’s connections are checked from its pre-request callback
(libcurl 7.80 or later).
pool: usizeConnections kept warm (native) or the most libcurl may use at once.
request_timeout_ms: u32Time from sending a request to its complete response, in milliseconds.
buf_size: usizeNative: receive buffer per connection (must hold the largest response).
background_connect: boolNative: open connections on the driver’s helper thread
(Driver::connect_background), keeping handshake CPU off the loop.
In a process that may use the polling CPU only (a pod with one CPU,
crate::placement) HttpClient::new then fails with
Error::Cpu, unless driver.inline_connect_fallback is set: the
pool then opens connections on the loop, as with false.
curl_drive: CurlDriveCurl: how libcurl is driven.
curl_ca_file: Option<String>Curl: a CA bundle file instead of the system store. (Native trust comes
from the rustls configuration passed to HttpClient::new.)
curl_allow_non_idempotent_methods: boolCurl: accept POST, PUT, PATCH and every method other than GET, HEAD,
OPTIONS and DELETE. Off by default: libcurl sends a request again, up
to 5 times, when the reused connection it went out on dies before any
reply byte, so an order could run twice. Off, such a request fails
with Error::CurlResend. Send orders through the native client,
which never re-sends.
connect_gate: boolNative: every pool connect waits for ClientHandler::connect_gate,
the first ones included, so new opens nothing and
HttpClient::poll refuses (Error::Config). For a venue that
limits connects per IP. Give the pool a budget bucket of its own:
venues’ connect limits count WebSocket connects, not HTTP ones. Off
(default): new opens every connection at once.
reconnect_seed: u64Native: the seed of the reconnect delays’ jitter; 0 picks one at
random. A fixed seed gives the same delays every run (tests).