Skip to main content

ensure_h2_or_h3_uri_authority

Function ensure_h2_or_h3_uri_authority 

pub fn ensure_h2_or_h3_uri_authority<Body>(
    request: &mut Request<Body>,
) -> Result<(), Box<dyn Error + Sync + Send>>
Available on crate features http and std only.
Expand description

Ensure an HTTP/2 or HTTP/3 request carries its authority and scheme in the URI.

HTTP/2 and HTTP/3 require the :authority/:scheme pseudo-headers, which the underlying crates derive from the URI. When converting up from HTTP/1 (where the authority lives in the Host header) the URI authority and scheme are materialized from the request authority if the URI lacks a host. Used both when upgrading a request to HTTP/2+ and as a general send-time backstop.