http::client
The client: connection pool, HTTP/1.1 keep-alive, HTTP/2 over TLS (ALPN) or by prior knowledge, redirects, timeouts.
Structs
ClientConfigSource
pub struct ClientConfigClient settings. Every field has a default.
Time from sending a request to its response head (per hop).
Longest wait for one read of a response body.
Redirects followed; 0 returns 3xx responses as they are.
Http11, orHttp2to speak HTTP/2 tohttpURLs by prior knowledge (h2c).httpsURLs offer both through ALPN and use HTTP/2 when the server picks it.Idle HTTP/1.1 connections kept per origin.
Idle connections older than this are not reused.
Sent as
User-Agentunless the request has one.
ClientSource
pub struct ClientAn HTTP client. Copies share the connection pool.
Sourcepub fn new(§cfg: ClientConfig | none = none) -> Client
Sourcepub fn with_tls(§tls_cfg: tls::ClientConfig, cfg: ClientConfig | none = none) -> Client Send
req, following redirects as configured.One request / response, no redirects.
Idle HTTP/1.1 connections pooled for
origin(http://host:port).
Functions
getSource
pub async fn get(url: str) throws (HttpError) -> Response GET url with a default client.