Skip to main content

ensure_h1_host_header

Function ensure_h1_host_header 

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

Ensure an HTTP/1.x request carries a Host header.

HTTP/1 carries the routing authority in the Host header, whereas HTTP/2 and HTTP/3 carry it in the :authority pseudo-header (the URI). The Host header is derived from the request authority when missing. Used both when downgrading a request to HTTP/1 and as a general send-time backstop.