Disable connection persistence and enable a 5 second connect timeout

This commit is contained in:
Cameron Gutman 2016-05-09 18:31:40 -04:00
parent 1278277d46
commit 23b152e71a

View File

@ -76,6 +76,12 @@ int http_request(char* url, PHTTP_DATA data) {
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _write_curl); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _write_curl);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function);
curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L);
curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, 0L);
curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1L);
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, data);
curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_URL, url);