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(services/gcs): Remove HOST header to avoid gcs RESET connection #2139

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/service_test_gcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ jobs:
- name: Test
shell: bash
working-directory: core
# Workaround
# gcs presign test failed for https://github.com/apache/incubator-opendal/issues/2125
# We should remove this feature until the issue is fixed.
run: cargo test gcs --features=native-tls -- --show-output
run: cargo test gcs -- --show-output
env:
RUST_BACKTRACE: full
RUST_LOG: debug
Expand Down
10 changes: 9 additions & 1 deletion core/src/services/gcs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::fmt::Formatter;
use std::sync::Arc;

use async_trait::async_trait;
use http::header::HOST;
use http::StatusCode;
use log::debug;
use reqsign::GoogleCredentialLoader;
Expand Down Expand Up @@ -544,7 +545,14 @@ impl Accessor for GcsBackend {
self.core.sign_query(&mut req, args.expire()).await?;

// We don't need this request anymore, consume it directly.
let (parts, _) = req.into_parts();
let (mut parts, _) = req.into_parts();
// Always remove host header, let users' client to set it based on HTTP
// version.
//
// As discussed in <https://github.com/seanmonstar/reqwest/issues/1809>,
// google server could send RST_STREAM of PROTOCOL_ERROR if our request
// contains host header.
parts.headers.remove(HOST);

Ok(RpPresign::new(PresignedRequest::new(
parts.method,
Expand Down