Skip to main content

remove_illegal_h2_request_headers

Function remove_illegal_h2_request_headers 

pub fn remove_illegal_h2_request_headers(headers: &mut HeaderMap)
Available on crate features http and std only.
Expand description

Remove headers that are illegal on an HTTP/2 (or HTTP/3) request.

HTTP/2 forbids connection-specific (hop-by-hop) header fields: the only exception is TE, and even then only with the value trailers (RFC 9113 §8.2.2). This removes the connection-specific headers (including any named by a Connection header), plus Host (replaced by the :authority pseudo-header) and Sec-WebSocket-Key (unused in the HTTP/2 WebSocket handshake per RFC 8441 §5.1).