You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/06/20 22:53:20 UTC
[arrow-rs] branch master updated: gcp: Exclude authorization header when bearer empty (#4418)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 0bcf200ce gcp: Exclude authorization header when bearer empty (#4418)
0bcf200ce is described below
commit 0bcf200ce22bd9a767dbe4c0fefcda6176e66f6e
Author: Vaibhav Rabber <vr...@gmail.com>
AuthorDate: Wed Jun 21 04:23:14 2023 +0530
gcp: Exclude authorization header when bearer empty (#4418)
GCP tries to authorize when there's the authorization header. If the
bearer is empty, exclude the header since this doesn't let us get a
public object.
Signed-off-by: Vaibhav <vr...@gmail.com>
---
object_store/src/gcp/mod.rs | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/object_store/src/gcp/mod.rs b/object_store/src/gcp/mod.rs
index 7b1127354..d4d370373 100644
--- a/object_store/src/gcp/mod.rs
+++ b/object_store/src/gcp/mod.rs
@@ -394,16 +394,19 @@ impl GetClient for GoogleCloudStorageClient {
false => Method::GET,
};
- let response = self
- .client
- .request(method, url)
- .bearer_auth(&credential.bearer)
- .with_get_options(options)
- .send_retry(&self.retry_config)
- .await
- .context(GetRequestSnafu {
- path: path.as_ref(),
- })?;
+ let mut request = self.client.request(method, url).with_get_options(options);
+
+ if !credential.bearer.is_empty() {
+ request = request.bearer_auth(&credential.bearer);
+ }
+
+ let response =
+ request
+ .send_retry(&self.retry_config)
+ .await
+ .context(GetRequestSnafu {
+ path: path.as_ref(),
+ })?;
Ok(response)
}