Browse Source

Fix curl crash when DNS does not resolve.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
4cf91916c8
2 changed files with 6 additions and 1 deletions
  1. +1
    -1
      dep/Makefile
  2. +5
    -0
      src/network.cpp

+ 1
- 1
dep/Makefile View File

@@ -131,7 +131,7 @@ curl-7.79.1:
rm curl-7.79.1.tar.gz rm curl-7.79.1.tar.gz


CURL_FLAGS += --enable-symbol-hiding --enable-shared=no CURL_FLAGS += --enable-symbol-hiding --enable-shared=no
CURL_FLAGS += --enable-http --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-threaded-resolver --disable-pthreads --disable-verbose --disable-sspi --disable-ntlm --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-doh --disable-mime --disable-dateparse --disable-netrc --disable-progress-meter --disable-alt-svc
CURL_FLAGS += --enable-http --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --enable-threaded-resolver --enable-pthreads --disable-verbose --disable-sspi --disable-ntlm --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-doh --disable-mime --disable-dateparse --disable-netrc --disable-progress-meter --disable-alt-svc
CURL_FLAGS += --without-hyper --without-zlib --without-brotli --without-zstd --without-libpsl --without-libgsasl --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-nghttp3 --without-quiche CURL_FLAGS += --without-hyper --without-zlib --without-brotli --without-zstd --without-libpsl --without-libgsasl --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-nghttp3 --without-quiche
CURL_FLAGS += --with-ssl="$(DEP_PATH)" CURL_FLAGS += --with-ssl="$(DEP_PATH)"




+ 5
- 0
src/network.cpp View File

@@ -27,6 +27,11 @@ static CURL* createCurl() {
// 15 second timeout for requests // 15 second timeout for requests
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 15); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 15);


// If curl can't resolve a DNS entry, it sends a signal to interrupt the process.
// However, since we use curl on non-main thread, this crashes the application.
// So tell curl not to signal.
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);

std::string caPath = asset::system("cacert.pem"); std::string caPath = asset::system("cacert.pem");
curl_easy_setopt(curl, CURLOPT_CAINFO, caPath.c_str()); curl_easy_setopt(curl, CURLOPT_CAINFO, caPath.c_str());




Loading…
Cancel
Save