]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftp: support growing files with CURLOPT_IGNORE_CONTENT_LENGTH
authorfractal-access <116177727+fractal-access@users.noreply.github.com>
Wed, 19 Oct 2022 13:37:44 +0000 (14:37 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 26 Nov 2022 16:02:54 +0000 (17:02 +0100)
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

lib/ftp.c

index c6e31e1b64f1788bc8e7dc7b4e6a984d5f989950..c07bafe17752bc98af17cb5966b4814ffed438b1 100644 (file)
--- 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