Skip to main content

Module alt_svc

Module alt_svc 

Available on crate features http and std only.
Expand description

Learn HTTP alternative services from origin responses.

RFC 7838 allows an origin to advertise alternative protocols, hosts and ports; the mechanism is independent of HTTP/3. AltSvcCache retains all advertised protocols, and connector selection applies client capabilities. Response headers are learned here; HttpServiceConnector also activates connection-level learning of HTTP/2 ALTSVC frames, including idle connections. DNS HTTPS/SVCB discovery is a separate mechanism and must not be recorded as an Alt-Svc advertisement.

Each request supplies its logical origin; connection metadata supplies the actual endpoint, authenticated identity and policy scope. Connections with verification disabled therefore never teach https alternatives; a custom TLS stack must publish TlsServerAuthentication and its ConnectionPolicyScope to take part. The middleware records response hints. It sets the typed Alt-Used request header only when configured with send_alt_used or asked by a request’s SendAltUsed extension, since RFC 7838 §5 makes it a SHOULD that some clients never send. Connection selection, authentication and retry policy remain the transport’s responsibility; a request is dispatched exactly once.

Structs§

AltSvc
Service applying an AltSvcLayer to an established connection.
AltSvcBody
Response body preserving the underlying frames and errors while recording complete responses and remote failures of a discovered alternative. Dropping an unread body is not evidence of success or endpoint failure. The wrapper does not allocate.
AltSvcCache
Bounded Alt-Svc advertisements, independent of connector protocol capabilities.
AltSvcLayer
Observe alternative services on an HTTP request service.
SendAltUsed
Request extension asking the AltSvc service to send Alt-Used when the request is served by an alternative service.