From 915438460abe53e5d3dcb1b2a6fd47f56c7151bb Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Mar 2021 10:00:02 +0100 Subject: FTP: allow SIZE to fail when doing (resumed) upload Added test 362 to verify. Reported-by: Jordan Brown Fixes #6715 Regression since 7ea2e1d0c5a7f (7.73.0) --- lib/ftp.c | 8 ++++++-- tests/data/Makefile.inc | 2 +- tests/data/test362 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 tests/data/test362 diff --git a/lib/ftp.c b/lib/ftp.c index 56e7cf29e..8b347e34f 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2309,8 +2309,12 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data, } else if(ftpcode == 550) { /* "No such file or directory" */ - failf(data, "The file does not exist"); - return CURLE_REMOTE_FILE_NOT_FOUND; + /* allow a SIZE failure for (resumed) uploads, when probing what command + to use */ + if(instate != FTP_STOR_SIZE) { + failf(data, "The file does not exist"); + return CURLE_REMOTE_FILE_NOT_FOUND; + } } if(instate == FTP_SIZE) { diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index f6e48e3de..6306b5980 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -60,7 +60,7 @@ test325 test326 test327 test328 test329 test330 test331 test332 test333 \ test334 test335 test336 test337 test338 test339 test340 test341 test342 \ test343 test344 test345 test346 test347 test348 test349 test350 test351 \ test352 test353 test354 test355 test356 test357 test358 test359 test360 \ -test361 \ +test361 test362 \ \ test393 test394 test395 test396 test397 \ \ diff --git a/tests/data/test362 b/tests/data/test362 new file mode 100644 index 000000000..ad585419d --- /dev/null +++ b/tests/data/test362 @@ -0,0 +1,51 @@ + + + +FTP +EPSV +STOR + + + +# Client-side + + +ftp + + +FTP resume upload file with nothing to start from + + +data + to + see +that FTP +works + so does it? + + +ftp://%HOSTIP:%FTPPORT/362 -T log/test362.txt --continue-at - + + + + + +data + to + see +that FTP +works + so does it? + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +SIZE 362 +STOR 362 +QUIT + + + -- cgit v1.2.1