From 722b7bf7accda97f366a6902a4b1df55e39563cf Mon Sep 17 00:00:00 2001 From: Max Carrara Date: Thu, 19 Oct 2023 10:57:24 +0200 Subject: [PATCH] fix #4779: client: add missing "Connection" header for HTTP2 upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds the missing "Connection: upgrade" HTTP header [1] when requesting an upgrade to HTTP 2. Doing so is mandated in the HTTP Semantics RFC [2], and without this, (reverse) proxies that strictly follow the standard could potentially break. [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade [2]: RFC 9110, 7.8. Upgrade: “[...] sender of Upgrade MUST also send an "Upgrade" connection option in the Connection header [...]” Reported-By: McTwist Signed-off-by: Max Carrara [ TL: added RFC reference and use case to commit message ] Signed-off-by: Thomas Lamprecht --- pbs-client/src/http_client.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs index 90d0d04b..b803c19f 100644 --- a/pbs-client/src/http_client.rs +++ b/pbs-client/src/http_client.rs @@ -764,6 +764,8 @@ impl HttpClient { ); } + req.headers_mut() + .insert("Connection", HeaderValue::from_str("upgrade").unwrap()); req.headers_mut() .insert("UPGRADE", HeaderValue::from_str(&protocol_name).unwrap());