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-flight-sql-postgresql.git


The following commit(s) were added to refs/heads/main by this push:
     new 931821e  Add support for Apache Arrow C++ 25.0.0 or later (#219)
931821e is described below

commit 931821ed1d92bfc78ebf0ca12f42d940fc64a2c4
Author: Sutou Kouhei <[email protected]>
AuthorDate: Sun Nov 15 21:50:45 2026 +0900

    Add support for Apache Arrow C++ 25.0.0 or later (#219)
    
    Closes GH-218
    
    Recent Apache Arrow C++ headers require C++20. So we use C++20 instead
    of C++17.
    
    `arrow::util::base64_decode()` returns `arrow::Result<std::string>`
    instead of `std::string` since Apache Arrow C++ 25.0.0. So we check the
    result and report an unauthenticated error on invalid input.
    
    Co-authored-by: Claude Fable 5.2 <[email protected]>
---
 meson.build |  2 +-
 src/afs.cc  | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 6226b9d..c558f75 100644
--- a/meson.build
+++ b/meson.build
@@ -18,7 +18,7 @@
 project('arrow-flight-sql-postgresql', 'c', 'cpp',
         default_options: [
           'buildtype=debug',
-          'cpp_std=c++17',
+          'cpp_std=c++20',
         ],
         license: 'Apache-2.0',
         # Meson 1.1.0 or later is required.
diff --git a/src/afs.cc b/src/afs.cc
index eb24161..db83d8f 100644
--- a/src/afs.cc
+++ b/src/afs.cc
@@ -4000,8 +4000,20 @@ class HeaderAuthServerMiddlewareFactory : public 
arrow::flight::ServerMiddleware
                std::getline(valueStream, type, ' ');
                if (type == "Basic")
                {
-                       std::stringstream decodedStream(
-                               
arrow::util::base64_decode(value.substr(valueStream.tellg())));
+                       auto encoded = value.substr(valueStream.tellg());
+#if ARROW_VERSION_MAJOR >= 25
+                       auto decodedResult = 
arrow::util::base64_decode(encoded);
+                       if (!decodedResult.ok())
+                       {
+                               return arrow::flight::MakeFlightError(
+                                       
arrow::flight::FlightStatusCode::Unauthenticated,
+                                       std::string("invalid Basic credentials: 
") +
+                                               
decodedResult.status().ToString());
+                       }
+                       std::stringstream decodedStream(*decodedResult);
+#else
+                       std::stringstream 
decodedStream(arrow::util::base64_decode(encoded));
+#endif
                        std::string userName("");
                        std::string password("");
                        std::getline(decodedStream, userName, ':');

Reply via email to