Closed
Description
Describe the bug
CURL returns CURLE_BAD_FUNCTION_ARGUMENT when a call is made to any HTTPS URL. This error started appearing after curl versions 8.12, which suggests some of the new changes to how CURL is doing SSL caching needs an update to downstream consumers.
Exception or Stack Trace
Unhandled exception at 0x00007FFC4AA0933A in azure-sdk-for-cpp-testing.exe: Microsoft C++ exception: Azure::Core::Http::TransportException at memory location 0x0000007F7C7FE430.
> libcurl-d.dll!schannel_connect(Curl_cfilter * cf, Curl_easy * data, bool * done) Line 1676 C
libcurl-d.dll!schannel_recv(Curl_cfilter * cf, Curl_easy * data, char * buf, unsigned __int64 len, CURLcode * err) Line 2071 C
libcurl-d.dll!ssl_cf_recv(Curl_cfilter * cf, Curl_easy * data, char * buf, unsigned __int64 len, CURLcode * err) Line 1530 C
libcurl-d.dll!Curl_cf_def_recv(Curl_cfilter * cf, Curl_easy * data, char * buf, unsigned __int64 len, CURLcode * err) Line 112 C
libcurl-d.dll!Curl_cf_def_recv(Curl_cfilter * cf, Curl_easy * data, char * buf, unsigned __int64 len, CURLcode * err) Line 112 C
libcurl-d.dll!Curl_cf_recv(Curl_easy * data, int num, char * buf, unsigned __int64 len, CURLcode * code) Line 250 C
libcurl-d.dll!Curl_conn_recv(Curl_easy * data, int sockindex, char * buf, unsigned __int64 blen, __int64 * n) Line 917 C
libcurl-d.dll!curl_easy_recv(void * d, void * buffer, unsigned __int64 buflen, unsigned __int64 * n) Line 1271 C
azure-core.dll!Azure::Core::Http::CurlConnection::ReadFromSocket(unsigned char * buffer, unsigned __int64 bufferSize, const Azure::Core::Context & context) Line 1117 C++
azure-core.dll!Azure::Core::Http::CurlSession::ReadStatusLineAndHeadersFromRawResponse(const Azure::Core::Context & context, bool reuseInternalBuffer) Line 855 C++
azure-core.dll!Azure::Core::Http::CurlSession::Perform(const Azure::Core::Context & context) Line 470 C++
azure-core.dll!Azure::Core::Http::CurlTransport::Send(Azure::Core::Http::Request & request, const Azure::Core::Context & context) Line 363 C++
azure-sdk-for-cpp-testing.exe!main() Line 15 C++
azure-sdk-for-cpp-testing.exe!invoke_main() Line 79 C++
azure-sdk-for-cpp-testing.exe!__scrt_common_main_seh() Line 288 C++
azure-sdk-for-cpp-testing.exe!__scrt_common_main() Line 331 C++
azure-sdk-for-cpp-testing.exe!mainCRTStartup(void * __formal) Line 17 C++
kernel32.dll!BaseThreadInitThunk() + 23 bytes Unknown
ntdll.dll!RtlUserThreadStart() + 44 bytes Unknown
To Reproduce
int main()
{
std::string url{ "https://www.bing.com" };
auto http_request = Azure::Core::Http::Request{ Azure::Core::Http::HttpMethod::Get, Azure::Core::Url {url} };
Azure::Core::Http::CurlTransport transport{};
auto response = transport.Send(http_request, Azure::Core::Context{});
auto body_vec = response->ExtractBodyStream()->ReadToEnd();
std::cout << "Finished" << std::endl;
return 0;
}
with curl version >= 8.12.1
Code Snippet
for (CURLcode readResult = CURLE_AGAIN; readResult == CURLE_AGAIN;)
{
readResult = curl_easy_recv(m_handle.get(), buffer, bufferSize, &readBytes);
switch (readResult)
{
case CURLE_AGAIN: {
// start polling operation
auto pollUntilSocketIsReady = pollSocketUntilEventOrTimeout(
context, m_curlSocket, PollSocketDirection::Read, 60000L);
if (pollUntilSocketIsReady == 0)
{
throw TransportException("Timeout waiting for socket to read.");
}
else if (pollUntilSocketIsReady < 0)
{ // negative value, error while polling
throw TransportException("Error while polling for socket ready read");
}
// Ready to continue download.
break;
}
case CURLE_OK: {
break;
}
default: {
// Error reading from socket
throw TransportException(
"Error while reading from network socket. CURLE code: " + std::to_string(readResult)
+ ". " + std::string(curl_easy_strerror(readResult)));
}
}
}
Expected behavior
No error
Screenshots
Setup (please complete the following information):
- OS: Windows 11 25H2
- IDE : Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.13.6
- Version of the Library used: 1.15
Additional context
Add any other context about the problem here.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x ] Bug Description Added
- [x ] Repro Steps Added
- [x ] Setup information Added
Metadata
Metadata
Assignees
Labels
This issue points to a problem in the data-plane of the library.Issues that are reported by GitHub users external to the Azure organization.Workflow: This issue needs attention from Azure service team or SDK teamThe issue doesn't require a change to the product in order to be resolved. Most issues start as that