pub fn strip_hop_by_hop(
headers: &mut HeaderMap,
keep_upgrade: bool,
preserve_te: bool,
) -> Vec<String>Expand description
Header names always treated as hop-by-hop per RFC 7230 section 6.1
(plus the de-facto Proxy-Connection), and any name listed in ANY
Connection header (RFC 7230 allows multiple; only get_all sees them
all). TE is dropped — EXCEPT for a gRPC request (DW-039), whose
spec-mandated TE: trailers rides through so conformant gRPC
servers see the client’s dialect (h2 carries trailers natively; the
header is the courtesy contract). Upgrade (and its Connection
token) survives only when the request is being tunneled.
Returns the Connection token list collected before stripping (original
case, deduplicated, order preserved) so the tunneling caller can rebuild
a Connection header with the surviving tokens. The owned list is
materialized only when keep_upgrade is set — the one caller that
consumes it is the upgrade-tunneling path; everyone else gets an empty
Vec (PERF: no per-request String allocations for the ubiquitous
Connection: keep-alive).
(Public so the DW-024 micro-benchmark can exercise it directly; it is not part of the stable public surface.)