pub struct Connector<T> { /* private fields */ }
Expand description
Manages HTTP client network connectivity.
The Connector
type uses a builder-like combinator pattern for service
construction that finishes by calling the .finish()
method.
use std::time::Duration;
use actix_http::client::Connector;
let connector = Connector::new()
.timeout(Duration::from_secs(5))
.finish();
Implementations
pub fn new(
) -> Connector<impl Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, TcpStream>, Error = ConnectError> + Clone>
pub fn connector<S1, Io1>(self, connector: S1) -> Connector<S1> where
Io1: ActixStream + Debug + 'static,
S1: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, Io1>, Error = TcpConnectError> + Clone,
pub fn connector<S1, Io1>(self, connector: S1) -> Connector<S1> where
Io1: ActixStream + Debug + 'static,
S1: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, Io1>, Error = TcpConnectError> + Clone,
Use custom connector.
impl<S, IO> Connector<S> where
IO: ActixStream + Debug + 'static,
S: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, IO>, Error = TcpConnectError> + Clone + 'static,
impl<S, IO> Connector<S> where
IO: ActixStream + Debug + 'static,
S: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, IO>, Error = TcpConnectError> + Clone + 'static,
Tcp connection timeout, i.e. max time to connect to remote host including dns name resolution. Set to 5 second by default.
Tls handshake timeout, i.e. max time to do tls handshake with remote host after tcp connection established. Set to 5 second by default.
Use custom OpenSSL SslConnector
instance.
Use custom Rustls ClientConfig
instance.
Sets maximum supported HTTP major version.
Supported versions are HTTP/1.1 and HTTP/2.
Sets the initial window size (in octets) for HTTP/2 stream-level flow control for received data.
The default value is 65,535 and is good for APIs, but not for big objects.
Sets the initial window size (in octets) for HTTP/2 connection-level flow control for received data.
The default value is 65,535 and is good for APIs, but not for big objects.
Set total number of simultaneous connections per type of scheme.
If limit is 0, the connector has no limit.
The default limit size is 100.
Set keep-alive period for opened connection.
Keep-alive period is the period between connection usage. If the delay between repeated usages of the same connection exceeds this period, the connection is closed. Default keep-alive period is 15 seconds.
Set max lifetime period for connection.
Connection lifetime is max lifetime of any opened connection until it is closed regardless of keep-alive period. Default lifetime period is 75 seconds.
Set server connection disconnect timeout in milliseconds.
Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the socket get dropped. This timeout affects only secure connections.
To disable timeout set value to 0.
By default disconnect timeout is set to 3000 milliseconds.
Set local IP Address the connector would use for establishing connection.
pub fn finish(
self
) -> ConnectorServicePriv<TcpConnectorService<TcpConnectorInnerService<S>>, Rc<dyn Service<Connect, Response = (Box<dyn ConnectionIo>, Protocol), Error = ConnectError, Future = LocalBoxFuture<'static, Result<(Box<dyn ConnectionIo>, Protocol), ConnectError>>>>, IO, Box<dyn ConnectionIo>>
pub fn finish(
self
) -> ConnectorServicePriv<TcpConnectorService<TcpConnectorInnerService<S>>, Rc<dyn Service<Connect, Response = (Box<dyn ConnectionIo>, Protocol), Error = ConnectError, Future = LocalBoxFuture<'static, Result<(Box<dyn ConnectionIo>, Protocol), ConnectError>>>>, IO, Box<dyn ConnectionIo>>
Finish configuration process and create connector service.
The Connector
builder always concludes by calling finish()
last in its combinator chain.
Auto Trait Implementations
impl<T> !RefUnwindSafe for Connector<T>
impl<T> !UnwindSafe for Connector<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more