force http 1.1 on the libcurl transport adapter (#2978)

* force http 1.1

* update wording
This commit is contained in:
Victor Vazquez 2021-10-20 11:43:28 -07:00 committed by GitHub
parent e0dcc20a82
commit dcc6f12c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,8 @@
### Bugs Fixed
[2848](https://github.com/Azure/azure-sdk-for-cpp/issues/2848) Update the libcurl transport adapter to work with HTTP/1.1 only.
### Other Changes
## 1.2.1 (2021-09-02)

View File

@ -1407,6 +1407,16 @@ std::unique_ptr<CurlNetworkConnection> CurlConnectionPool::ExtractOrCreateCurlCo
}
}
// curl-transport adapter supports only HTTP/1.1
// https://github.com/Azure/azure-sdk-for-cpp/issues/2848
// The libcurl uses HTTP/2 by default, if it can be negotiated with a server on handshake.
if (!SetLibcurlOption(newHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1, &result))
{
throw Azure::Core::Http::TransportException(
_detail::DefaultFailedToGetNewConnectionTemplate + host + ". Failed to set libcurl HTTP/1.1"
+ ". " + std::string(curl_easy_strerror(result)));
}
auto performResult = curl_easy_perform(newHandle);
if (performResult != CURLE_OK)
{