Skip to main content

http2_eager_handshake

Function http2_eager_handshake 

pub async fn http2_eager_handshake<IO, BodyConnection>(
    io: IO,
    exec: Executor,
) -> Result<(HttpClientService<BodyConnection>, H2PeerSettingsHandle), OpaqueError>
where IO: Io + Unpin + ExtensionsRef, BodyConnection: Body + Unpin + Send + 'static, <BodyConnection as Body>::Data: Send + Sync + 'static, <BodyConnection as Body>::Error: Into<Box<dyn Error + Send + Sync>>,
Available on crate features http-full and http only.
Expand description

Establish an HTTP/2 connection on the pre-established IO (bytes) stream without a triggering request, and return both the HttpClientService and a H2PeerSettingsHandle that resolves to the peer’s initial SETTINGS frame once received.

Used by MITM relays that need to observe upstream h2 SETTINGS before the ingress server’s initial SETTINGS frame is written to the downstream client. Like the h2 arm of http_connect, request- scoped builder knobs (H2ClientContextParams, PseudoHeaderOrder) are read from the egress IO’s extensions and applied — letting UA-emulation profiles flow through the eager path as well. The per-request Protocol extension is intentionally NOT honored here: there is no request yet at eager-handshake time.