From: fractal-access <116177727+fractal-access@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:37:44 +0000 (+0100) Subject: ftp: support growing files with CURLOPT_IGNORE_CONTENT_LENGTH X-Git-Tag: curl-7_87_0~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=76b3f5f2cf0f091720413690c49f8d0ada5bfae5;p=thirdparty%2Fcurl.git ftp: support growing files with CURLOPT_IGNORE_CONTENT_LENGTH When using the option CURLOPT_IGNORE_CONTENT_LENGTH (set.ignorecl in code) to support growing files in FTP, the code should ignore the initial size it gets from the server as this will not be the final size of the file. This is done in ftp_state_quote() to prevent a size request being issued in the initial sequence. However, in a later call to ftp_state_get_resp() the code attempts to get the size of the content again if it doesn't already have it, by parsing the response from the RETR request. This fix prevents this parsing of the response to get the size when the set.ignorecl option is set. This should maintain the size value as -1, unknown, in this situation. Closes #9772 --- diff --git a/lib/ftp.c b/lib/ftp.c index c6e31e1b64..c07bafe177 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2448,6 +2448,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data, if((instate != FTP_LIST) && !data->state.prefer_ascii && + !data->set.ignorecl && (ftp->downloadsize < 1)) { /* * It seems directory listings either don't show the size or very