diff --git a/cpp/src/arrow/flight/cookie_internal.cc b/cpp/src/arrow/flight/cookie_internal.cc index 99fa8b238dd..df09a77afb7 100644 --- a/cpp/src/arrow/flight/cookie_internal.cc +++ b/cpp/src/arrow/flight/cookie_internal.cc @@ -64,6 +64,11 @@ size_t CaseInsensitiveHash::operator()(const std::string& key) const { return std::hash{}(upper_string); } +bool CaseInsensitiveEqual::operator()(const std::string& lhs, + const std::string& rhs) const { + return strcasecmp(lhs.c_str(), rhs.c_str()) == 0; +} + Cookie Cookie::Parse(std::string_view cookie_header_value) { // Parse the cookie string. If the cookie has an expiration, record it. // If the cookie has a max-age, calculate the current time + max_age and set that as diff --git a/cpp/src/arrow/flight/cookie_internal.h b/cpp/src/arrow/flight/cookie_internal.h index 62c0390c585..98b936edb33 100644 --- a/cpp/src/arrow/flight/cookie_internal.h +++ b/cpp/src/arrow/flight/cookie_internal.h @@ -41,6 +41,12 @@ class ARROW_FLIGHT_EXPORT CaseInsensitiveComparator { bool operator()(const std::string& t1, const std::string& t2) const; }; +/// \brief Case insensitive equality comparator for use by unordered cookie map. +class ARROW_FLIGHT_EXPORT CaseInsensitiveEqual { + public: + bool operator()(const std::string& lhs, const std::string& rhs) const; +}; + /// \brief Case insensitive hasher for use by cookie caching map. Cookies are not /// case-sensitive. class ARROW_FLIGHT_EXPORT CaseInsensitiveHash { @@ -117,7 +123,7 @@ class ARROW_FLIGHT_EXPORT CookieCache { // Mutex must be used to protect cookie cache. std::mutex mutex_; - std::unordered_map + std::unordered_map cookies; }; diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc index 422c45fc059..8b2b564d8db 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc @@ -157,9 +157,6 @@ void FlightSqlConnection::Connect(const ConnPropertyMap& properties, client_options_ = BuildFlightClientOptions(properties, missing_attr, flight_ssl_configs); - const std::shared_ptr& cookie_factory = GetCookieFactory(); - client_options_.middleware.push_back(cookie_factory); - std::unique_ptr flight_client; ThrowIfNotOK(FlightClient::Connect(location, client_options_).Value(&flight_client)); PopulateMetadataSettings(properties);