update curl transport options to support ignore proxy from system (#3564)
* update curl transport options to support ignore proxy from system * update changelog * bug fix for cl
This commit is contained in:
parent
075b8d0046
commit
bdb71249ce
@ -8,6 +8,8 @@
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
- Updated field type `CurlTransportOptions.Proxy` from `std::string` to `Azure::Nullable<std::string>`. This change allow to se an empty string to make libcurl ignore proxy settings from environment [](https://github.com/Azure/azure-sdk-for-cpp/issues/3537).
|
||||
|
||||
### Other Changes
|
||||
|
||||
## 1.5.0 (2022-03-31)
|
||||
|
||||
@ -49,7 +49,11 @@ namespace Azure { namespace Core { namespace Http {
|
||||
struct CurlTransportOptions final
|
||||
{
|
||||
/**
|
||||
* @brief The string for the proxy is passed directly to the libcurl handle without any parsing
|
||||
* @brief The string for the proxy is passed directly to the libcurl handle without any parsing.
|
||||
*
|
||||
* @details libcurl will use system's environment proxy configuration (if it is set) when the \p
|
||||
* Proxy setting is not set (is null). Setting an empty string will make libcurl to ignore any
|
||||
* proxy settings from the system (use no proxy).
|
||||
*
|
||||
* @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.
|
||||
@ -57,7 +61,7 @@ namespace Azure { namespace Core { namespace Http {
|
||||
* @remark The default value is an empty string (no proxy).
|
||||
*
|
||||
*/
|
||||
std::string Proxy;
|
||||
Azure::Nullable<std::string> Proxy;
|
||||
/**
|
||||
* @brief The string for the certificate authenticator is sent to libcurl handle directly.
|
||||
*
|
||||
|
||||
@ -1225,7 +1225,7 @@ inline std::string GetConnectionKey(std::string const& host, CurlTransportOption
|
||||
{
|
||||
std::string key(host);
|
||||
key.append(!options.CAInfo.empty() ? options.CAInfo : "0");
|
||||
key.append(!options.Proxy.empty() ? options.Proxy : "0");
|
||||
key.append(options.Proxy ? (options.Proxy->empty() ? "NoProxy" : options.Proxy.Value()) : "0");
|
||||
key.append(!options.SslOptions.EnableCertificateRevocationListCheck ? "1" : "0");
|
||||
key.append(options.SslVerifyPeer ? "1" : "0");
|
||||
key.append(options.NoSignal ? "1" : "0");
|
||||
@ -1356,13 +1356,13 @@ std::unique_ptr<CurlNetworkConnection> CurlConnectionPool::ExtractOrCreateCurlCo
|
||||
/******************** Curl handle options apply to all connections created
|
||||
* The keepAlive option is managed by the session directly.
|
||||
*/
|
||||
if (!options.Proxy.empty())
|
||||
if (options.Proxy)
|
||||
{
|
||||
if (!SetLibcurlOption(newHandle, CURLOPT_PROXY, options.Proxy.c_str(), &result))
|
||||
if (!SetLibcurlOption(newHandle, CURLOPT_PROXY, options.Proxy->c_str(), &result))
|
||||
{
|
||||
throw Azure::Core::Http::TransportException(
|
||||
_detail::DefaultFailedToGetNewConnectionTemplate + hostDisplayName
|
||||
+ ". Failed to set proxy to:" + options.Proxy + ". "
|
||||
+ ". Failed to set proxy to:" + options.Proxy.Value() + ". "
|
||||
+ std::string(curl_easy_strerror(result)));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user