diff --git a/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp b/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp index 940651ea5..e4608cb80 100644 --- a/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp @@ -11,13 +11,81 @@ #ifdef BUILD_CURL_HTTP_TRANSPORT_ADAPTER #include "azure/core/context.hpp" -#include "azure/core/http/curl/curl_connection.hpp" -#include "azure/core/http/curl/curl_connection_pool.hpp" -#include "azure/core/http/curl/curl_session.hpp" #include "azure/core/http/http.hpp" #include "azure/core/http/transport.hpp" namespace Azure { namespace Core { namespace Http { + + /** + * @brief The available options to set libcurl ssl options. + * + * @remark The SDK will map the enum option to libcurl's specific option. See more info here: + * https://curl.haxx.se/libcurl/c/CURLOPT_SSL_OPTIONS.html + * + */ + struct CurlTransportSSLOptions + { + bool AllowBeast = false; + bool NoRevoke = false; + }; + + /** + * @brief Set the curl connection options like a proxy and CA path. + * + */ + struct CurlTransportOptions + { + /** + * @brief The string for the proxy is passed directly to the libcurl handle without any parsing + * + * @remark No validation for the string is done by the Azure SDK. More about this option: + * https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html. + * + * @remark The default value is an empty string (no proxy). + * + */ + std::string Proxy; + /** + * @brief The string for the certificate authenticator is sent to libcurl handle directly. + * + * @remark The Azure SDK will not check if the path is valid or not. + * + * @remark The default is the built-in system specific path. More about this option: + * https://curl.haxx.se/libcurl/c/CURLOPT_CAINFO.html + * + */ + std::string CAInfo; + /** + * @brief All HTTP requests will keep the connection channel open to the service. + * + * @remark The channel might be closed by the server if the server response has an error code. + * A connection won't be re-used if it is abandoned in the middle of an operation. + * operation. + * + * @remark This option is managed directly by the Azure SDK. No option is set for the curl + * handle. It is `true` by default. + */ + bool HttpKeepAlive = true; + /** + * @brief This option determines whether curl verifies the authenticity of the peer's + * certificate. + * + * @remark The default value is `true`. More about this option: + * https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html + * + */ + bool SSLVerifyPeer = true; + + /** + * @brief Define the SSL options for the libcurl handle. + * + * @remark See more info here: https://curl.haxx.se/libcurl/c/CURLOPT_SSL_OPTIONS.html. + * The default option is all options `false`. + * + */ + CurlTransportSSLOptions SSLOptions; + }; + /** * @brief Concrete implementation of an HTTP Transport that uses libcurl. * diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index fd824ef09..dcb14e28e 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -7,6 +7,11 @@ #include "azure/core/http/transport.hpp" #include "azure/core/internal/log.hpp" +// Private incude +#include "curl_connection.hpp" +#include "curl_connection_pool.hpp" +#include "curl_session.hpp" + #ifdef POSIX #include // for poll() #endif diff --git a/sdk/core/azure-core/inc/azure/core/http/curl/curl_connection.hpp b/sdk/core/azure-core/src/http/curl/curl_connection.hpp similarity index 100% rename from sdk/core/azure-core/inc/azure/core/http/curl/curl_connection.hpp rename to sdk/core/azure-core/src/http/curl/curl_connection.hpp diff --git a/sdk/core/azure-core/inc/azure/core/http/curl/curl_connection_pool.hpp b/sdk/core/azure-core/src/http/curl/curl_connection_pool.hpp similarity index 61% rename from sdk/core/azure-core/inc/azure/core/http/curl/curl_connection_pool.hpp rename to sdk/core/azure-core/src/http/curl/curl_connection_pool.hpp index 3b56f5061..eb33bce82 100644 --- a/sdk/core/azure-core/inc/azure/core/http/curl/curl_connection_pool.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_connection_pool.hpp @@ -9,9 +9,10 @@ #pragma once -#include "azure/core/http/curl/curl_connection.hpp" #include "azure/core/http/http.hpp" +#include "curl_connection.hpp" + #include #include #include @@ -27,76 +28,6 @@ namespace Azure { namespace Core { namespace Test { namespace Azure { namespace Core { namespace Http { - /** - * @brief The available options to set libcurl ssl options. - * - * @remark The SDK will map the enum option to libcurl's specific option. See more info here: - * https://curl.haxx.se/libcurl/c/CURLOPT_SSL_OPTIONS.html - * - */ - struct CurlTransportSSLOptions - { - bool AllowBeast = false; - bool NoRevoke = false; - }; - - /** - * @brief Set the curl connection options like a proxy and CA path. - * - */ - struct CurlTransportOptions - { - /** - * @brief The string for the proxy is passed directly to the libcurl handle without any parsing - * - * @remark No validation for the string is done by the Azure SDK. More about this option: - * https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html. - * - * @remark The default value is an empty string (no proxy). - * - */ - std::string Proxy; - /** - * @brief The string for the certificate authenticator is sent to libcurl handle directly. - * - * @remark The Azure SDK will not check if the path is valid or not. - * - * @remark The default is the built-in system specific path. More about this option: - * https://curl.haxx.se/libcurl/c/CURLOPT_CAINFO.html - * - */ - std::string CAInfo; - /** - * @brief All HTTP requests will keep the connection channel open to the service. - * - * @remark The channel might be closed by the server if the server response has an error code. - * A connection won't be re-used if it is abandoned in the middle of an operation. - * operation. - * - * @remark This option is managed directly by the Azure SDK. No option is set for the curl - * handle. It is `true` by default. - */ - bool HttpKeepAlive = true; - /** - * @brief This option determines whether curl verifies the authenticity of the peer's - * certificate. - * - * @remark The default value is `true`. More about this option: - * https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html - * - */ - bool SSLVerifyPeer = true; - - /** - * @brief Define the SSL options for the libcurl handle. - * - * @remark See more info here: https://curl.haxx.se/libcurl/c/CURLOPT_SSL_OPTIONS.html. - * The default option is all options `false`. - * - */ - CurlTransportSSLOptions SSLOptions; - }; - /** * @brief CURL HTTP connection pool makes it possible to re-use one curl connection to perform * more than one request. Use this component when connections are not re-used by default. diff --git a/sdk/core/azure-core/inc/azure/core/http/curl/curl_session.hpp b/sdk/core/azure-core/src/http/curl/curl_session.hpp similarity index 99% rename from sdk/core/azure-core/inc/azure/core/http/curl/curl_session.hpp rename to sdk/core/azure-core/src/http/curl/curl_session.hpp index ec4ae312f..70b0f5e04 100644 --- a/sdk/core/azure-core/inc/azure/core/http/curl/curl_session.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_session.hpp @@ -11,10 +11,11 @@ #pragma once -#include "azure/core/http/curl/curl_connection.hpp" -#include "azure/core/http/curl/curl_connection_pool.hpp" #include "azure/core/http/http.hpp" +#include "curl_connection.hpp" +#include "curl_connection_pool.hpp" + #include #include diff --git a/sdk/core/azure-core/test/ut/curl_options.cpp b/sdk/core/azure-core/test/ut/curl_options.cpp index 6025ce1ee..d665fa61f 100644 --- a/sdk/core/azure-core/test/ut/curl_options.cpp +++ b/sdk/core/azure-core/test/ut/curl_options.cpp @@ -12,6 +12,9 @@ #include +#include "../../src/http/curl/curl_connection.hpp" +#include "../../src/http/curl/curl_session.hpp" + #include #include diff --git a/sdk/core/azure-core/test/ut/curl_session.hpp b/sdk/core/azure-core/test/ut/curl_session.hpp index 9911d31e6..398842af6 100644 --- a/sdk/core/azure-core/test/ut/curl_session.hpp +++ b/sdk/core/azure-core/test/ut/curl_session.hpp @@ -9,11 +9,13 @@ * */ +#include +#include #include #include #include -#include +#include "../../src/http/curl/curl_connection_pool.hpp" namespace Azure { namespace Core { namespace Test { diff --git a/sdk/core/azure-core/test/ut/curl_session_test.cpp b/sdk/core/azure-core/test/ut/curl_session_test.cpp index 6b930b82d..ea725aa09 100644 --- a/sdk/core/azure-core/test/ut/curl_session_test.cpp +++ b/sdk/core/azure-core/test/ut/curl_session_test.cpp @@ -6,7 +6,8 @@ #include #include -#include +#include "../../src/http/curl/curl_connection.hpp" +#include "../../src/http/curl/curl_session.hpp" using ::testing::_; using ::testing::DoAll; diff --git a/sdk/core/azure-core/test/ut/transport_adapter_curl.cpp b/sdk/core/azure-core/test/ut/transport_adapter_curl.cpp index 25834b35c..066ef40eb 100644 --- a/sdk/core/azure-core/test/ut/transport_adapter_curl.cpp +++ b/sdk/core/azure-core/test/ut/transport_adapter_curl.cpp @@ -8,6 +8,9 @@ #include #include +#include "../../src/http/curl/curl_connection.hpp" +#include "../../src/http/curl/curl_connection_pool.hpp" + using testing::ValuesIn; namespace Azure { namespace Core { namespace Test {