diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-03-10 22:31:47 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-03-15 11:43:47 +0100 |
commit | f38c7290b1d57a7cad27ede73d88bfa2e8349d1a (patch) | |
tree | 2b7300fc7788128f4d8d8d0eba9626647b93645c /lib/transfer.c | |
parent | 51fde337471c9125e7bf425e7ce0a0bf53691992 (diff) | |
download | curl-f38c7290b1d57a7cad27ede73d88bfa2e8349d1a.tar.gz |
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
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index e76834eb3..d02baa4c3 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -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) |