1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-18 05:41:50 +01:00

fix(http2): remove host header when using http2 (#3516)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Joel Wurtz 2024-12-29 17:55:32 +01:00 committed by GitHub
parent bb1442e20b
commit 856480cd90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@
- Update `brotli` dependency to `7`. - Update `brotli` dependency to `7`.
- Prevent panics on connection pool drop when Tokio runtime is shutdown early. - Prevent panics on connection pool drop when Tokio runtime is shutdown early.
- Minimum supported Rust version (MSRV) is now 1.75. - Minimum supported Rust version (MSRV) is now 1.75.
- Do not send `Host` header on HTTP/2 requests, as it is not required, and some web servers may reject it.
## 3.5.1 ## 3.5.1

View File

@ -12,7 +12,7 @@ use h2::{
SendStream, SendStream,
}; };
use http::{ use http::{
header::{HeaderValue, CONNECTION, CONTENT_LENGTH, TRANSFER_ENCODING}, header::{HeaderValue, CONNECTION, CONTENT_LENGTH, HOST, TRANSFER_ENCODING},
request::Request, request::Request,
Method, Version, Method, Version,
}; };
@ -97,7 +97,7 @@ where
// TODO: consider skipping other headers according to: // TODO: consider skipping other headers according to:
// https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.2 // https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.2
// omit HTTP/1.x only headers // omit HTTP/1.x only headers
CONNECTION | TRANSFER_ENCODING => continue, CONNECTION | TRANSFER_ENCODING | HOST => continue,
CONTENT_LENGTH if skip_len => continue, CONTENT_LENGTH if skip_len => continue,
// DATE => has_date = true, // DATE => has_date = true,
_ => {} _ => {}