aboutsummaryrefslogtreecommitdiff
path: root/src/tool_operate.c
diff options
context:
space:
mode:
authorDaniel Hwang <gnawhleinad@github.com>2016-10-09 16:00:25 -0700
committerDaniel Stenberg <daniel@haxx.se>2016-11-11 10:00:54 +0100
commitcdfda3ee827da069f1871722278fd82e7cbb4194 (patch)
treeb7990d962afd012e3ed1955dc364642a7f93c7f1 /src/tool_operate.c
parentea80a2dcfcdc280ff412489dc3928600ec76296c (diff)
curl: Add --retry-connrefused
to consider ECONNREFUSED as a transient error. Closes #1064
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r--src/tool_operate.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index deae87753..d467b0df5 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1441,6 +1441,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
enum {
RETRY_NO,
RETRY_TIMEOUT,
+ RETRY_CONNREFUSED,
RETRY_HTTP,
RETRY_FTP,
RETRY_LAST /* not used */
@@ -1452,6 +1453,13 @@ static CURLcode operate_do(struct GlobalConfig *global,
(CURLE_FTP_ACCEPT_TIMEOUT == result))
/* retry timeout always */
retry = RETRY_TIMEOUT;
+ else if(config->retry_connrefused &&
+ (CURLE_COULDNT_CONNECT == result)) {
+ long oserrno;
+ curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &oserrno);
+ if(ECONNREFUSED == oserrno)
+ retry = RETRY_CONNREFUSED;
+ }
else if((CURLE_OK == result) ||
(config->failonerror &&
(CURLE_HTTP_RETURNED_ERROR == result))) {
@@ -1499,7 +1507,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(retry) {
static const char * const m[]={
- NULL, "timeout", "HTTP error", "FTP error"
+ NULL,
+ "timeout",
+ "connection refused",
+ "HTTP error",
+ "FTP error"
};
warnf(config->global, "Transient problem: %s "