Skip to main content

http_connect

Function http_connect 

pub async fn http_connect<T, Input, BodyConnection>(
    transport: T,
    input: Input,
    exec: Executor,
) -> Result<EstablishedClientConnection<HttpClientService<BodyConnection>, Input>, OpaqueError>
where T: IntoHttpTransport, Input: AuthorityInputExt + ProtocolInputExt + ExtensionsRef + HttpVersionInputExt + TargetHttpVersionInputExt + Send + 'static, BodyConnection: Body + Unpin + Send + 'static, <BodyConnection as Body>::Data: Send + 'static, <BodyConnection as Body>::Error: Into<Box<dyn Error + Send + Sync>>,
Available on crate features dns and http-backend and http and std and tcp only.
Expand description

Perform the HTTP handshake on an established byte stream or QUIC transport. The selected protocol must agree with the transport; metadata remains attached to the resulting service for pooling and request adaptation. The input’s protocol distinguishes secure origins without inferring TLS from a port. Custom secure transports must publish ConnectionReuse to enable pooling. Connections using HTTP/2 or HTTP/3 without ALPN wait for peer SETTINGS. No default deadline is applied here or by EasyHttpWebClient. Callers that need bounded establishment must wrap their connector in a timeout, including the TLS/QUIC handshake and this readiness wait. Cancellation drops the pending HTTP connection. Custom QUIC transports can publish rama_net::tls::AlpnPolicy::OutOfBandAgreement in connection extensions when HTTP/3 was agreed through another mechanism.