summaryrefslogtreecommitdiff
path: root/content/fetchers
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-10 21:51:54 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-10 21:51:54 +0000
commit4d1ef3bac4ba09423a51af809ef0c9220402f050 (patch)
treec6b9dcdf2c832195ab418dcb0913ac62c3ae3b5a /content/fetchers
parent727bbbd216ccd0f4c11164b54348a120f5311d40 (diff)
downloadnetsurf-4d1ef3bac4ba09423a51af809ef0c9220402f050.tar.gz
netsurf-4d1ef3bac4ba09423a51af809ef0c9220402f050.tar.bz2
Add support for retrying timed-out cURL fetches.
This is an attempt to amelioriate the situation found in #2384 where we see the cURL connect() failing to complete. Based on the pcap from the bug log, we believe that RISC OS is likely failing to signal the completion of the connection to cURL. As such, cURL times out. This change permits retries of timed out connections in the hope that a fresh socket FD might subsequently function correctly. The defaults chosen mean that the previous behaviour of 30 seconds before timeout is reported will remain the same, but in that time we will make 3 separate attempts to connect the socket.
Diffstat (limited to 'content/fetchers')
-rw-r--r--content/fetchers/curl.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index a2c6f2eb4..624cdbf41 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -973,11 +973,19 @@ static void fetch_curl_done(CURL *curl_handle, CURLcode result)
msg.data.cert_err.num_certs = i;
fetch_send_callback(&msg, f->fetch_handle);
} else if (error) {
- if (result != CURLE_SSL_CONNECT_ERROR) {
+ switch (result) {
+ case CURLE_SSL_CONNECT_ERROR:
+ msg.type = FETCH_SSL_ERR;
+ break;
+
+ case CURLE_OPERATION_TIMEDOUT:
+ msg.type = FETCH_TIMEDOUT;
+ msg.data.error = curl_easy_strerror(result);
+ break;
+
+ default:
msg.type = FETCH_ERROR;
msg.data.error = curl_easy_strerror(result);
- } else {
- msg.type = FETCH_SSL_ERR;
}
fetch_send_callback(&msg, f->fetch_handle);
@@ -1302,7 +1310,7 @@ nserror fetch_curl_register(void)
SETOPT(CURLOPT_LOW_SPEED_LIMIT, 1L);
SETOPT(CURLOPT_LOW_SPEED_TIME, 180L);
SETOPT(CURLOPT_NOSIGNAL, 1L);
- SETOPT(CURLOPT_CONNECTTIMEOUT, 30L);
+ SETOPT(CURLOPT_CONNECTTIMEOUT, nsoption_uint(curl_fetch_timeout));
if (nsoption_charp(ca_bundle) &&
strcmp(nsoption_charp(ca_bundle), "")) {