diff options
author | Stefan Agner <stefan@agner.ch> | 2018-04-06 21:00:02 +0200 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2018-04-07 02:57:57 -0400 |
commit | 464a019cbe028f1e0a85a6bd4631e41411b0d32d (patch) | |
tree | 922b1cb7df769336b4090678e41c8f44a9f2ab84 | |
parent | dd03e8c281582af454fabfb4a666a5b232d518aa (diff) |
tool_operate: Fix retry on FTP 4xx to ignore other protocols
Only treat response code as FTP response codes in case the
protocol type is FTP.
This fixes an issue where an HTTP download was treated as FTP
in case libcurl returned with 33. This happens when the
download has already finished and the server responses 416:
HTTP/1.1 416 Requested Range Not Satisfiable
This should not be treated as an FTP error.
Fixes #2464
Closes #2465
-rw-r--r-- | src/tool_operate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index 0aad54282..8eac65d6a 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1570,9 +1570,13 @@ static CURLcode operate_do(struct GlobalConfig *global, } } /* if CURLE_OK */ else if(result) { + long protocol; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response); + curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); - if(response/100 == 4) + if((protocol == CURLPROTO_FTP || protocol == CURLPROTO_FTPS) && + response / 100 == 4) /* * This is typically when the FTP server only allows a certain * amount of users and we are not one of them. All 4xx codes |