Move the default transport adapter assignation to the source (#1206)
fixes: #1169
This commit is contained in:
parent
7d2cc26553
commit
6a317e8b87
@ -11,7 +11,7 @@ set(AZ_ALL_LIBRARIES ON)
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
|
||||
option(BUILD_TRANSPORT_CURL "Build an HTTP transport implementation with CURL" OFF)
|
||||
option(BUILD_TRANSPORT_WINHTTP "Build an HTTP transport implementation with WIN HTTP" OFF)
|
||||
option(BUILD_TRANSPORT_CUSTOM "Implementation for GetCustomHttpTransport method must be linked to the final application" OFF)
|
||||
option(BUILD_TRANSPORT_CUSTOM "Implementation for AzureSdkGetCustomHttpTransport method must be linked to the final application" OFF)
|
||||
option(BUILD_TESTING "Build test cases" OFF)
|
||||
option(BUILD_CODE_COVERAGE "Build gcov targets for HTML and XML reports. Requires debug build and BUILD_TESTING" OFF)
|
||||
option(BUILD_DOCUMENTATION "Create HTML based API documentation (requires Doxygen)" OFF)
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
# POSIX: Only CURL is acceptable. If WIN_HTTP is set, generate step will fail for user #
|
||||
|
||||
if (BUILD_TRANSPORT_CUSTOM)
|
||||
message("Using the user-defined transport adapter. Make sure `GetCustomHttpTransport` is implemented and linked.")
|
||||
message("Using the user-defined transport adapter. Make sure `AzureSdkGetCustomHttpTransport` is implemented and linked.")
|
||||
add_compile_definitions(BUILD_TRANSPORT_CUSTOM_ADAPTER)
|
||||
endif()
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
- Added a WinHTTP-based `HttpTransport` called `WinHttpTransport` and use that as the default `TransportPolicyOptions.Transport` on Windows when sending and receiving requests and responses over the wire.
|
||||
- Added `Range` type to `Azure::Core::Http` namespace.
|
||||
- Added support for long-running operations with `Operation<T>`.
|
||||
- Added support for setting a custom transport adapter by implementing the method `std::shared_ptr<HttpTransport> ::AzureSdkGetCustomHttpTransport()`.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
@ -15,6 +16,10 @@
|
||||
- Removed option `AllowBeast` from `CurlTransportSSLOptions` in `CurlTransportOptions`.
|
||||
- Changed default option `NoRevoke` from `CurlTransportSSLOptions` for the `CurlTransportOptions` to `true`. This disables the revocation list checking by default.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed for setting up the default transport adapter.
|
||||
|
||||
## 1.0.0-beta.3 (2020-11-11)
|
||||
|
||||
### New Features
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
#include "azure/core/logging/logging.hpp"
|
||||
#include "azure/core/uuid.hpp"
|
||||
|
||||
// Need to include the transport adapters offered by the SDK here so anyone can use them by just
|
||||
// including policy.hpp
|
||||
#include "azure/core/http/curl/curl.hpp"
|
||||
#include "azure/core/http/winhttp/win_http_client.hpp"
|
||||
|
||||
@ -23,6 +25,10 @@
|
||||
|
||||
namespace Azure { namespace Core { namespace Http {
|
||||
|
||||
namespace Details {
|
||||
std::shared_ptr<HttpTransport> GetTransportAdapter();
|
||||
}
|
||||
|
||||
class NextHttpPolicy;
|
||||
|
||||
/**
|
||||
@ -113,20 +119,10 @@ namespace Azure { namespace Core { namespace Http {
|
||||
* curl transport adapter and winhttp transport adapter on Windows.
|
||||
*
|
||||
* @remark When using a custom transport adapter, the implementation for
|
||||
* `GetCustomHttpTransport` must be linked in the end-user application.
|
||||
* `AzureSdkGetCustomHttpTransport` must be linked in the end-user application.
|
||||
*
|
||||
*/
|
||||
|
||||
// The order of these checks is important so that WinHttp is picked over Curl on Windows, when
|
||||
// both are defined.
|
||||
#if defined(BUILD_TRANSPORT_CUSTOM_ADAPTER)
|
||||
std::shared_ptr<HttpTransport> Transport = ::GetCustomHttpTransport();
|
||||
#elif defined(BUILD_TRANSPORT_WINHTTP_ADAPTER)
|
||||
std::shared_ptr<HttpTransport> Transport
|
||||
= std::make_shared<Azure::Core::Http::WinHttpTransport>();
|
||||
#else
|
||||
std::shared_ptr<HttpTransport> Transport = std::make_shared<Azure::Core::Http::CurlTransport>();
|
||||
#endif
|
||||
std::shared_ptr<HttpTransport> Transport = Details::GetTransportAdapter();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -6,6 +6,19 @@
|
||||
using Azure::Core::Context;
|
||||
using namespace Azure::Core::Http;
|
||||
|
||||
std::shared_ptr<HttpTransport> Azure::Core::Http::Details::GetTransportAdapter()
|
||||
{
|
||||
// The order of these checks is important so that WinHttp is picked over Curl on Windows, when
|
||||
// both are defined.
|
||||
#if defined(BUILD_TRANSPORT_CUSTOM_ADAPTER)
|
||||
return ::AzureSdkGetCustomHttpTransport();
|
||||
#elif defined(BUILD_TRANSPORT_WINHTTP_ADAPTER)
|
||||
return std::make_shared<Azure::Core::Http::WinHttpTransport>();
|
||||
#else
|
||||
return std::make_shared<Azure::Core::Http::CurlTransport>();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<RawResponse> TransportPolicy::Send(
|
||||
Context const& ctx,
|
||||
Request& request,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user