From 22abe6d74fdfd8144541b33cc902b6a41064f88a Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Mon, 12 Aug 2013 22:19:09 +0200 Subject: [PATCH] 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). --- Frameworks/network/src/download.cc | 1 + Frameworks/network/src/download_tbz.cc | 1 + Frameworks/network/src/post.cc | 1 + 3 files changed, 3 insertions(+) diff --git a/Frameworks/network/src/download.cc b/Frameworks/network/src/download.cc index 7cba0940..9d676e5e 100644 --- a/Frameworks/network/src/download.cc +++ b/Frameworks/network/src/download.cc @@ -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()); diff --git a/Frameworks/network/src/download_tbz.cc b/Frameworks/network/src/download_tbz.cc index a073d350..71130fbd 100644 --- a/Frameworks/network/src/download_tbz.cc +++ b/Frameworks/network/src/download_tbz.cc @@ -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); diff --git a/Frameworks/network/src/post.cc b/Frameworks/network/src/post.cc index 7197f368..c02620dd 100644 --- a/Frameworks/network/src/post.cc +++ b/Frameworks/network/src/post.cc @@ -58,6 +58,7 @@ long post_to_server (std::string const& url, std::map curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errorbuf); curl_easy_setopt(handle, CURLOPT_FAILONERROR, true); + curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1); if(headersOut) {