From a3269f7ab285dbeb44a3a7dbc163fcadd65087f9 Mon Sep 17 00:00:00 2001 From: Qishuai Liu Date: Sat, 27 Apr 2024 00:33:30 +0900 Subject: [PATCH] fix(http2): stop removing "Trailer" header in HTTP/2 responses as per RFC 9110 (#3648) --- src/proto/h2/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/proto/h2/mod.rs b/src/proto/h2/mod.rs index 201bbd1396..adb6de87f9 100644 --- a/src/proto/h2/mod.rs +++ b/src/proto/h2/mod.rs @@ -8,7 +8,7 @@ use std::task::{Context, Poll}; use bytes::{Buf, Bytes}; use futures_util::ready; use h2::{Reason, RecvStream, SendStream}; -use http::header::{HeaderName, CONNECTION, TE, TRAILER, TRANSFER_ENCODING, UPGRADE}; +use http::header::{HeaderName, CONNECTION, TE, TRANSFER_ENCODING, UPGRADE}; use http::HeaderMap; use pin_project_lite::pin_project; @@ -31,15 +31,13 @@ cfg_server! { /// Default initial stream window size defined in HTTP2 spec. pub(crate) const SPEC_WINDOW_SIZE: u32 = 65_535; -// List of connection headers from: -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection +// List of connection headers from RFC 9110 Section 7.6.1 // // TE headers are allowed in HTTP/2 requests as long as the value is "trailers", so they're // tested separately. -static CONNECTION_HEADERS: [HeaderName; 5] = [ +static CONNECTION_HEADERS: [HeaderName; 4] = [ HeaderName::from_static("keep-alive"), HeaderName::from_static("proxy-connection"), - TRAILER, TRANSFER_ENCODING, UPGRADE, ];