aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2020-04-04 16:16:18 -0400
committerJay Satiro <raysatiro@yahoo.com>2020-05-12 03:00:15 -0400
commitb995bb58cbd976280b132ee2148376fadd071063 (patch)
tree6e2c8903f3ae9e5bc515828df90f045dab186750 /src
parent98e5904165859679cd78825bcccb52306ee3bb66 (diff)
tool: Add option --retry-all-errors to retry on any error
The "sledgehammer" of retrying. Closes https://github.com/curl/curl/pull/5185
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c4
-rw-r--r--src/tool_help.c2
-rw-r--r--src/tool_operate.c5
4 files changed, 12 insertions, 0 deletions
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index d7eebf598..c5b8c3071 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -223,6 +223,7 @@ struct OperationConfig {
bool tcp_nodelay;
bool tcp_fastopen;
long req_retry; /* number of retries */
+ bool retry_all_errors; /* retry on any error */
bool retry_connrefused; /* set connection refused as a transient error */
long retry_delay; /* delay between retries (in seconds) */
long retry_maxtime; /* maximum time to keep retrying */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 0252ee029..c0ab67c3f 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -197,6 +197,7 @@ static const struct LongShort aliases[]= {
{"$Y", "suppress-connect-headers", ARG_BOOL},
{"$Z", "compressed-ssh", ARG_BOOL},
{"$~", "happy-eyeballs-timeout-ms", ARG_STRING},
+ {"$!", "retry-all-errors", ARG_BOOL},
{"0", "http1.0", ARG_NONE},
{"01", "http1.1", ARG_NONE},
{"02", "http2", ARG_NONE},
@@ -927,6 +928,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
if(err)
return err;
break;
+ case '!': /* --retry-all-errors */
+ config->retry_all_errors = toggle;
+ break;
case 'k': /* --proxy-negotiate */
if(curlinfo->features & CURL_VERSION_SPNEGO)
diff --git a/src/tool_help.c b/src/tool_help.c
index 5afaf822e..92ccae3b9 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -399,6 +399,8 @@ static const struct helptxt helptext[] = {
"Retry on connection refused (use with --retry)"},
{" --retry-delay <seconds>",
"Wait time between retries"},
+ {" --retry-all-errors",
+ "Retry all errors (use with --retry) (read manpage, don't use by default)"},
{" --retry-max-time <seconds>",
"Retry only within this period"},
{" --sasl-authzid <identity> ",
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 66c6468bc..6d489aa30 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -437,6 +437,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
config->retry_maxtime*1000L)) ) {
enum {
RETRY_NO,
+ RETRY_ALL_ERRORS,
RETRY_TIMEOUT,
RETRY_CONNREFUSED,
RETRY_HTTP,
@@ -506,11 +507,15 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
retry = RETRY_FTP;
}
+ if(result && !retry && config->retry_all_errors)
+ retry = RETRY_ALL_ERRORS;
+
if(retry) {
long sleeptime = 0;
curl_off_t retry_after = 0;
static const char * const m[]={
NULL,
+ "(retrying all errors)",
"timeout",
"connection refused",
"HTTP error",