/* URLs of debuginfods, separated by url_delim. */
static const char *url_delim = " ";
-/* Timeout for debuginfods, in seconds (to get at least 100K). */
+/* Timeout for debuginfods, in seconds. Applies separately to the server
+ connect phase and to download at least 100K once connection is
+ established. */
static const long default_timeout = 90;
/* Default retry count for download error. */
timeout);
curl_easy_setopt_ck (data->handle, CURLOPT_LOW_SPEED_LIMIT,
100 * 1024L);
+
+ /* CURLOPT_LOW_SPEED_LIMIT/_TIME don't apply during the server connection
+ phase. Set CURLOPT_CONNECTTIMEOUT_MS as well so the timeout also
+ limits how long we wait for an unresponsive server. */
+ long connect_timeout_ms = (timeout > LONG_MAX / 1000L
+ ? LONG_MAX : timeout * 1000L);
+ curl_easy_setopt_ck (data->handle, CURLOPT_CONNECTTIMEOUT_MS,
+ connect_timeout_ms);
}
curl_easy_setopt_ck(data->handle, CURLOPT_FILETIME, (long) 1);
curl_easy_setopt_ck(data->handle, CURLOPT_FOLLOWLOCATION, (long) 1);
.TP
.B $DEBUGINFOD_TIMEOUT
This environment variable governs the download \fIcommencing\fP
-timeout for each debuginfod HTTP connection. A server that fails to
-provide at least 100K of data within this many seconds is skipped. The
-default is 90 seconds. (Zero or negative means "no timeout".)
+timeout, in seconds, for each debuginfod HTTP connection. A server is
+skipped if it either fails to establish a connection within the timeout or
+fails to provide at least 100K of data within the timeout. The default is
+90 seconds. (Zero or negative means "no timeout".)
.TP
.B $DEBUGINFOD_MAXTIME