Remove curl transport adapter models and private headers form public layer (#1023)

This commit is contained in:
Victor Vazquez 2020-11-30 15:54:21 -08:00 committed by GitHub
parent 84b76c30d4
commit cc75233a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 78 deletions

View File

@ -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.
*

View File

@ -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 <poll.h> // for poll()
#endif

View File

@ -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 <curl/curl.h>
#include <list>
#include <map>
@ -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.

View File

@ -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 <memory>
#include <string>

View File

@ -12,6 +12,9 @@
#include <azure/core/http/curl/curl.hpp>
#include "../../src/http/curl/curl_connection.hpp"
#include "../../src/http/curl/curl_session.hpp"
#include <string>
#include <vector>

View File

@ -9,11 +9,13 @@
*
*/
#include <azure/core/http/curl/curl.hpp>
#include <curl/curl.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <string>
#include <azure/core/http/curl/curl.hpp>
#include "../../src/http/curl/curl_connection_pool.hpp"
namespace Azure { namespace Core { namespace Test {

View File

@ -6,7 +6,8 @@
#include <azure/core/http/curl/curl.hpp>
#include <azure/core/http/http.hpp>
#include <curl/curl.h>
#include "../../src/http/curl/curl_connection.hpp"
#include "../../src/http/curl/curl_session.hpp"
using ::testing::_;
using ::testing::DoAll;

View File

@ -8,6 +8,9 @@
#include <string>
#include <thread>
#include "../../src/http/curl/curl_connection.hpp"
#include "../../src/http/curl/curl_connection_pool.hpp"
using testing::ValuesIn;
namespace Azure { namespace Core { namespace Test {