This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 787a6ab32e GH-42107: [C++][FS][Azure] Ensure setting 
BlobSasBuilder::Protocol (#42108)
787a6ab32e is described below

commit 787a6ab32e04fe259504a74c20b9e1135914490f
Author: Sutou Kouhei <[email protected]>
AuthorDate: Thu Jun 13 18:02:39 2024 +0900

    GH-42107: [C++][FS][Azure] Ensure setting BlobSasBuilder::Protocol (#42108)
    
    ### Rationale for this change
    
    `BlobSasBuilder::Protocol` is used in `BlobSasBuilder::GenerateSasToken()` 
and it doesn't have the default value. If we don't specify it explicitly, 
`GenerateSasToken()` result may be unexpected.
    
    ### What changes are included in this PR?
    
    Set `BlobSasBuilder::Protocol` explicitly based on 
`AzureOptions::blob_storage_scheme`. It's `https` by default but can be `http` 
when `enable_tls=false` query parameter is specified.
    
    If it's `http`, both of `https` and `http` are accepted as protocol.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    Yes.
    * GitHub Issue: #42107
    
    Authored-by: Sutou Kouhei <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/filesystem/azurefs.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cpp/src/arrow/filesystem/azurefs.cc 
b/cpp/src/arrow/filesystem/azurefs.cc
index 809aef32b3..ca64486724 100644
--- a/cpp/src/arrow/filesystem/azurefs.cc
+++ b/cpp/src/arrow/filesystem/azurefs.cc
@@ -418,6 +418,9 @@ AzureOptions::MakeDataLakeServiceClient() const {
 
 Result<std::string> AzureOptions::GenerateSASToken(
     Storage::Sas::BlobSasBuilder* builder, Blobs::BlobServiceClient* client) 
const {
+  using SasProtocol = Storage::Sas::SasProtocol;
+  builder->Protocol =
+      blob_storage_scheme == "http" ? SasProtocol::HttpsAndHttp : 
SasProtocol::HttpsOnly;
   if (storage_shared_key_credential_) {
     return builder->GenerateSasToken(*storage_shared_key_credential_);
   } else {

Reply via email to