Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix google cloud storage with rustls + http2 #1985

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

(Please put changes here.)
- Remove host HTTP header when using rustls

## [0.48.0] - 2022-04-24

Expand Down
4 changes: 4 additions & 0 deletions rusoto/core/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ where
message: format!("error building request: {}", err),
})?;

// we use HTTP/2 with rustls, the host header is required to sign the request
// Google cloud storage rejects HTTP/2 payloads containing a host header
#[cfg(any(feature = "rustls", feature = "rustls-webpki"))]
hyper_headers.remove("host");
Copy link
Author

@saroh saroh Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host header is required for HTTP/1.1 but not HTTP/2 it seems: https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.3

It'd be safer/necessary to put this behind a http2 or gcp-http2 feature because this'd break custom clients using HTTP/1 imho.

*http_request.headers_mut() = hyper_headers;

let f = client.request(http_request);
Expand Down