Disallow curl from using signals

If libcurl is built with the default DNS resolver then it will handle a timeout by using SIGALRM, though since we are using threads, and signals are not compatible with threads, this may have led to a crash in Curl_resolv_timeout (for users where a DNS lookup could take longer than the timeout, presumably 300 seconds).
This commit is contained in:
Allan Odgaard
2013-08-12 22:19:09 +02:00
parent 772143088a
commit 22abe6d74f
3 changed files with 3 additions and 0 deletions

View File

@@ -150,6 +150,7 @@ namespace network
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true);
curl_easy_setopt(handle, CURLOPT_FAILONERROR, true);
curl_easy_setopt(handle, CURLOPT_ENCODING, "");
curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1);
std::string const userAgent = request._user_agent == NULL_STR ? create_agent_info_string() : request._user_agent;
curl_easy_setopt(handle, CURLOPT_USERAGENT, userAgent.c_str());

View File

@@ -131,6 +131,7 @@ namespace network
curl_easy_setopt(handle, CURLOPT_FAILONERROR, true);
curl_easy_setopt(handle, CURLOPT_ENCODING, "");
curl_easy_setopt(handle, CURLOPT_USERAGENT, create_agent_info_string().c_str());
curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1);
char errorbuf[CURL_ERROR_SIZE];
curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errorbuf);

View File

@@ -58,6 +58,7 @@ long post_to_server (std::string const& url, std::map<std::string, std::string>
curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errorbuf);
curl_easy_setopt(handle, CURLOPT_FAILONERROR, true);
curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1);
if(headersOut)
{