Skip to content

Commit

Permalink
Remove OPENSSL_VERSION_NUMBER version check for the CAPath option in …
Browse files Browse the repository at this point in the history
…libcurl (#5009)

* Remove OPENSSL_VERSION_NUMBER version check for the CAPath option in
libcurl.

* Revert unit test change that caused an intentional error.

* Remove the openssl header.
  • Loading branch information
ahsonkhan authored Oct 5, 2023
1 parent 81d95c9 commit 9a2c2e1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 1 addition & 8 deletions sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
#include "azure/core/http/transport.hpp"
#include "azure/core/platform.hpp"

#if defined(AZ_PLATFORM_LINUX)
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x00905100L
#define _azure_SUPPORT_SETTING_CAPATH
#endif // OPENSSL_VERSION_NUMBER >= 0x00905100L
#endif // defined(AZ_PLATFORM_LINUX)

namespace Azure { namespace Core { namespace Http {
class CurlNetworkConnection;

Expand Down Expand Up @@ -130,7 +123,7 @@ namespace Azure { namespace Core { namespace Http {
*/
std::string CAInfo;

#if defined(_azure_SUPPORT_SETTING_CAPATH)
#if defined(AZ_PLATFORM_LINUX)
/**
* @brief Path to a directory which holds PEM encoded file, containing the certificate
* authorities sent to libcurl handle directly.
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core/src/http/curl/curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(_azure_SUPPORT_SETTING_CAPATH)
#if defined(AZ_PLATFORM_LINUX)
key.append(!options.CAPath.empty() ? options.CAPath : "0");
#else
key.append("0"); // CAPath is always empty on Windows;
Expand Down Expand Up @@ -2320,7 +2320,7 @@ CurlConnection::CurlConnection(
}
}

#if defined(_azure_SUPPORT_SETTING_CAPATH)
#if defined(AZ_PLATFORM_LINUX)
if (!options.CAPath.empty())
{
if (!SetLibcurlOption(m_handle, CURLOPT_CAPATH, options.CAPath.c_str(), &result))
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/test/ut/curl_options_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ namespace Azure { namespace Core { namespace Test {
.ConnectionPoolIndex.clear());
}

#if defined(_azure_SUPPORT_SETTING_CAPATH)
#if defined(AZ_PLATFORM_LINUX)
TEST(CurlTransportOptions, setCADirectory)
{
Azure::Core::Http::CurlTransportOptions curlOptions;
Expand Down

0 comments on commit 9a2c2e1

Please sign in to comment.