mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 08:38:49 -05:00
transfer: cap retries of "dead connections" to 5
When libcurl retries a connection due to it being "seemingly dead" or by REFUSED_STREAM, it will now only do it up five times before giving up, to avoid never-ending loops. Reported-by: Dima Tisnek Bug: https://curl.haxx.se/mail/lib-2020-03/0044.html Closes #5074
This commit is contained in:
parent
51fde33747
commit
f38c7290b1
@ -1779,6 +1779,12 @@ CURLcode Curl_retry_request(struct connectdata *conn,
|
||||
retry = TRUE;
|
||||
}
|
||||
if(retry) {
|
||||
#define CONN_MAX_RETRIES 5
|
||||
if(conn->retrycount++ >= CONN_MAX_RETRIES) {
|
||||
failf(data, "Connection died, tried %d times before giving up",
|
||||
CONN_MAX_RETRIES);
|
||||
return CURLE_SEND_ERROR;
|
||||
}
|
||||
infof(conn->data, "Connection died, retrying a fresh connect\n");
|
||||
*url = strdup(conn->data->change.url);
|
||||
if(!*url)
|
||||
|
@ -1099,7 +1099,7 @@ struct connectdata {
|
||||
struct http_connect_state *connect_state; /* for HTTP CONNECT */
|
||||
struct connectbundle *bundle; /* The bundle we are member of */
|
||||
int negnpn; /* APLN or NPN TLS negotiated protocol, CURL_HTTP_VERSION* */
|
||||
|
||||
int retrycount; /* number of retries on a new connection */
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
char *unix_domain_socket;
|
||||
BIT(abstract_unix_socket);
|
||||
|
Loading…
Reference in New Issue
Block a user