Skip to main content

proxy_request

Function proxy_request 

pub fn proxy_request(
    proxy: &ProxyAddress,
    origin: &Extensions,
) -> ConnectRequest
Available on crate feature net only.
Expand description

Create the request to establish the connection to proxy itself.

Its extensions are forked from those of the request that will travel through the proxy, so per-request configuration reaches the connection to the proxy while its own writes stay local.

The origin’s connection facts, such as its TargetHttpVersion, do not carry over: this request writes its own ConnectorTarget and ConnectorTransportProtocol, and a direct ProxyRoute unless the bag routes this hop through another proxy. An HTTP proxy whose address names no version negotiates one, whatever the origin request asks.

A TLS input belongs to the connection it configures, so the origin’s stop at this boundary. The hop’s own identity and ALPN follow from the route: its address is the authority the TLS connector names, its protocol and version the ALPN that connector offers. Anything else this hop needs comes from ProxyConnectionExtensions, whose contents land on this request’s own level. The route to proxy still decides where the dial goes: this writes its own target and transport after that.