]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: Fix retry on FTP 4xx to ignore other protocols
authorStefan Agner <stefan@agner.ch>
Fri, 6 Apr 2018 19:00:02 +0000 (21:00 +0200)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 7 Apr 2018 06:57:57 +0000 (02:57 -0400)
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

src/tool_operate.c

index 0aad54282658ef8680c6917ce9b7be2f588c9836..8eac65d6a3e823c512738d9ebe355b3412f29919 100644 (file)
@@ -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