pub struct HttpClientBuilder { /* private fields */ }client only.Expand description
Builder for HttpClient connector-level options.
Use HttpClient::builder to obtain one. The terminal methods mirror the
associated constructors on HttpClient; the existing constructors delegate
here, so HttpClient::plaintext() is exactly HttpClient::builder().plaintext().
Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
Sourcepub fn connect_timeout(self, dur: Duration) -> Self
pub fn connect_timeout(self, dur: Duration) -> Self
Bound the TCP connect phase.
This is hyper’s HttpConnector::set_connect_timeout,
applied to the inner connector for all three transport flavours. It
covers only the TCP connect(2) call (per resolved address — hyper
divides the timeout evenly across the address set). It does not
cover DNS resolution or, for with_tls, the TLS
handshake. Use a per-request timeout (e.g.
CallOptions::with_timeout) to bound DNS+connect+TLS+request as a
whole.
Unset (the default) means no explicit bound: TCP connect is governed by
the kernel’s tcp_syn_retries (typically ~130s on Linux). Set this when
the network path can silently drop SYNs and you’d rather fail fast than
stall on kernel retransmits.
Sourcepub fn plaintext(self) -> HttpClient
pub fn plaintext(self) -> HttpClient
Finish building as a plaintext client. See HttpClient::plaintext.
Sourcepub fn plaintext_http2_only(self) -> HttpClient
pub fn plaintext_http2_only(self) -> HttpClient
Finish building as an h2c-only plaintext client. See
HttpClient::plaintext_http2_only.
Sourcepub fn with_tls(self, tls_config: Arc<ClientConfig>) -> HttpClient
Available on crate feature client-tls only.
pub fn with_tls(self, tls_config: Arc<ClientConfig>) -> HttpClient
client-tls only.Finish building as a TLS client. See HttpClient::with_tls.
Trait Implementations§
Source§impl Clone for HttpClientBuilder
impl Clone for HttpClientBuilder
Source§fn clone(&self) -> HttpClientBuilder
fn clone(&self) -> HttpClientBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more