You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/04/26 16:17:00 UTC
[incubator-opendal] branch main updated: fix(services/gcs): Remove HOST header to avoid gcs RESET connection (#2139)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 2f5e31d2 fix(services/gcs): Remove HOST header to avoid gcs RESET connection (#2139)
2f5e31d2 is described below
commit 2f5e31d2b123bbb8b717581117cda2bdfd691c7f
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Apr 27 00:16:56 2023 +0800
fix(services/gcs): Remove HOST header to avoid gcs RESET connection (#2139)
fix(services/gcs): Remove HOST header to avoid gcs RESET
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
.github/workflows/service_test_gcs.yml | 5 +----
core/src/services/gcs/backend.rs | 10 +++++++++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/service_test_gcs.yml b/.github/workflows/service_test_gcs.yml
index 9ec3adf0..40838834 100644
--- a/.github/workflows/service_test_gcs.yml
+++ b/.github/workflows/service_test_gcs.yml
@@ -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
diff --git a/core/src/services/gcs/backend.rs b/core/src/services/gcs/backend.rs
index ce4eb563..5d01a534 100644
--- a/core/src/services/gcs/backend.rs
+++ b/core/src/services/gcs/backend.rs
@@ -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;
@@ -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,