Skip to main content

Crate fetch_options

Crate fetch_options 

Source
Expand description

Configuration options for HTTP client transport behavior.

This crate provides types for configuring various aspects of HTTP connections, including connection keep-alive behavior, connection pooling, and HTTP version support.

§Example

use std::time::Duration;

use fetch_options::{ConnectionLifetime, RequestFilter, TransportOptions};

fn configure(mut options: TransportOptions) -> TransportOptions {
    options.connect_timeout = Duration::from_secs(10);
    options.request_filter = RequestFilter::Https;
    options.connection_pool = options
        .connection_pool
        .max_connections(64)
        .connection_idle_timeout(Duration::from_secs(90))
        .connection_lifetime(ConnectionLifetime::fixed(Duration::from_secs(300)));

    options
}

let options = configure(TransportOptions::default());

Structs§

ConnectionInfo
Diagnostic information about the connection that served an HTTP response.
ConnectionLifetime
Backs ConnectionPoolOptions::connection_lifetime.
ConnectionPoolOptions
Configuration options for HTTP connection pooling.
Http2Options
Configuration options for HTTP/2 connections.
PoolIndex
Selects a specific connection pool for a request by index.
PoolSelection
Configures how requests are distributed across multiple connection pools.
TransportOptions
Public, transport-relevant subset of an HTTP client’s configuration.

Enums§

ConnectionIdleTimeout
Backs ConnectionPoolOptions::connection_idle_timeout.
ConnectionKeepAlive
Controls how HTTP connections are kept alive between requests.
RequestFilter
Controls which URI schemes the HTTP client is willing to send to.