From 6c6c4e9b354d077a84f43d62a8155ca69f444435 Mon Sep 17 00:00:00 2001 From: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Date: Wed, 21 May 2025 05:32:53 -0700 Subject: [PATCH] Update libcurl transport pool to include all options into connection key (#6583) Co-authored-by: Anton Kolesnyk --- sdk/core/azure-core/src/http/curl/curl.cpp | 4 ++++ .../azure-core/test/ut/curl_connection_pool_test.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index b97d898a7..2453398fe 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -1414,6 +1414,10 @@ inline std::string GetConnectionKey(std::string const& host, CurlTransportOption key.append(","); key.append(options.SslOptions.AllowFailedCrlRetrieval ? "FC" : "0"); key.append(","); + key.append(options.EnableCurlTracing ? "1" : "0"); + key.append(","); + key.append(options.EnableCurlSslCaching ? "1" : "0"); + key.append(","); #if LIBCURL_VERSION_NUM >= 0x074D00 // 7.77.0 key.append( !options.SslOptions.PemEncodedExpectedRootCertificates.empty() ? std::to_string( diff --git a/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp b/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp index 61ecc1004..8902a982f 100644 --- a/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp +++ b/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp @@ -58,7 +58,7 @@ namespace Azure { namespace Core { namespace Test { std::string const expectedConnectionKey(CreateConnectionKey( AzureSdkHttpbinServer::Schema(), AzureSdkHttpbinServer::Host(), - ",0,0,0,0,0,1,1,0,0,0,0")); + ",0,0,0,0,0,1,1,0,0,0,1,0,0")); { // Creating a new connection with default options @@ -129,7 +129,7 @@ namespace Azure { namespace Core { namespace Test { // Now test that using a different connection config won't re-use the same connection std::string const secondExpectedKey = AzureSdkHttpbinServer::Schema() + "://" - + AzureSdkHttpbinServer::Host() + ",0,0,0,0,0,1,0,0,0,0,200000"; + + AzureSdkHttpbinServer::Host() + ",0,0,0,0,0,1,0,0,0,0,1,0,200000"; { // Creating a new connection with options Azure::Core::Http::CurlTransportOptions options; @@ -441,7 +441,7 @@ namespace Azure { namespace Core { namespace Test { std::string const expectedConnectionKey(CreateConnectionKey( AzureSdkHttpbinServer::Schema(), AzureSdkHttpbinServer::Host(), - ",0,0,0,0,0,1,1,0,0,0,0")); + ",0,0,0,0,0,1,1,0,0,0,1,0,0")); // Creating a new connection with default options auto connection = Azure::Core::Http::_detail::CurlConnectionPool::g_curlConnectionPool @@ -479,7 +479,7 @@ namespace Azure { namespace Core { namespace Test { std::string const expectedConnectionKey(CreateConnectionKey( AzureSdkHttpbinServer::Schema(), AzureSdkHttpbinServer::Host(), - ":443,0,0,0,0,0,1,1,0,0,0,0")); + ":443,0,0,0,0,0,1,1,0,0,0,1,0,0")); // Creating a new connection with default options auto connection = Azure::Core::Http::_detail::CurlConnectionPool::g_curlConnectionPool @@ -518,7 +518,7 @@ namespace Azure { namespace Core { namespace Test { std::string const expectedConnectionKey(CreateConnectionKey( AzureSdkHttpbinServer::Schema(), AzureSdkHttpbinServer::Host(), - ",0,0,0,0,0,1,1,0,0,0,0")); + ",0,0,0,0,0,1,1,0,0,0,1,0,0")); // Creating a new connection with default options auto connection = Azure::Core::Http::_detail::CurlConnectionPool::g_curlConnectionPool @@ -555,7 +555,7 @@ namespace Azure { namespace Core { namespace Test { std::string const expectedConnectionKey(CreateConnectionKey( AzureSdkHttpbinServer::Schema(), AzureSdkHttpbinServer::Host(), - ":443,0,0,0,0,0,1,1,0,0,0,0")); + ":443,0,0,0,0,0,1,1,0,0,0,1,0,0")); // Creating a new connection with default options auto connection = Azure::Core::Http::_detail::CurlConnectionPool::g_curlConnectionPool