diff --git a/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp b/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp index 2fd3f0f67ec..d082b1faa6e 100644 --- a/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp @@ -13,6 +13,10 @@ #include "azure/core/http/policies/policy.hpp" #include "azure/core/http/transport.hpp" +#if defined(AZ_PLATFORM_LINUX) && OPENSSL_VERSION_NUMBER >= 0x00905100L +#define SUPPORT_SETTING_CAPATH +#endif + namespace Azure { namespace Core { namespace Http { class CurlNetworkConnection; @@ -122,7 +126,7 @@ namespace Azure { namespace Core { namespace Http { */ std::string CAInfo; -#if defined(AZ_PLATFORM_LINUX) +#if defined(SUPPORT_SETTING_CAPATH) /** * @brief Path to a directory which holds PEM encoded file, containing the certificate * authorities sent to libcurl handle directly. diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index 91c1a0164c6..8a98797cece 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -1283,7 +1283,7 @@ inline std::string GetConnectionKey(std::string const& host, CurlTransportOption key.append(","); key.append(!options.CAInfo.empty() ? options.CAInfo : "0"); key.append(","); -#if defined(AZ_PLATFORM_LINUX) +#if defined(SUPPORT_SETTING_CAPATH) key.append(!options.CAPath.empty() ? options.CAPath : "0"); #else key.append("0"); // CAPath is always empty on Windows; @@ -2320,7 +2320,7 @@ CurlConnection::CurlConnection( } } -#if defined(AZ_PLATFORM_LINUX) +#if defined(SUPPORT_SETTING_CAPATH) if (!options.CAPath.empty()) { if (!SetLibcurlOption(m_handle, CURLOPT_CAPATH, options.CAPath.c_str(), &result)) diff --git a/sdk/core/azure-core/test/ut/curl_options_test.cpp b/sdk/core/azure-core/test/ut/curl_options_test.cpp index 5d25f1def76..0139413c918 100644 --- a/sdk/core/azure-core/test/ut/curl_options_test.cpp +++ b/sdk/core/azure-core/test/ut/curl_options_test.cpp @@ -235,7 +235,7 @@ namespace Azure { namespace Core { namespace Test { .ConnectionPoolIndex.clear()); } -#if defined(AZ_PLATFORM_LINUX) +#if defined(SUPPORT_SETTING_CAPATH) TEST(CurlTransportOptions, setCADirectory) { Azure::Core::Http::CurlTransportOptions curlOptions;