Throw exception if curl_easy_init returns Null (#1239)

This commit is contained in:
ku-sourav 2020-12-23 03:53:29 +05:30 committed by GitHub
parent e23e9333c8
commit 14e947ff03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1094,6 +1094,12 @@ std::unique_ptr<CurlNetworkConnection> CurlConnectionPool::GetCurlConnection(
// Creating a new connection is thread safe. No need to lock mutex here.
// No available connection for the pool for the required host. Create one
CURL* newHandle = curl_easy_init();
if (!newHandle)
{
throw Azure::Core::Http::TransportException(
Details::c_DefaultFailedToGetNewConnectionTemplate + host + ". "
+ std::string("curl_easy_init returned Null"));
}
CURLcode result;
// Libcurl setup before open connection (url, connect_only, timeout)