From: fractal-access <116177727+fractal-access@users.noreply.github.com> Date: Thu, 10 Nov 2022 15:20:28 +0000 (+0100) Subject: test416: verify growing FTP file support X-Git-Tag: curl-7_87_0~104 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=383fb29da17df6fed2612cb95454103dadfe948f;p=thirdparty%2Fcurl.git test416: verify growing FTP file support Added setting: RETRSIZE [size] in the section. When set this will cause the test FTP server to return the size set (rather than the actual size) in the acknowledgement from a RETR request. Closes #9772 --- diff --git a/tests/FILEFORMAT.md b/tests/FILEFORMAT.md index 57fc299272..02628f67d8 100644 --- a/tests/FILEFORMAT.md +++ b/tests/FILEFORMAT.md @@ -307,6 +307,7 @@ about to issue. appear at once when a file is transferred - `RETRNOSIZE` - Make sure the RETR response doesn't contain the size of the file +- `RETRSIZE [size]` - Force RETR response to contain the specified size - `NOSAVE` - Don't actually save what is received - `SLOWDOWN` - Send FTP responses with 0.01 sec delay between each byte - `PASVBADIP` - makes PASV send back an illegal IP in its 227 response diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 8d8d66e334..905e803e84 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -67,7 +67,7 @@ test370 test371 test372 test373 test374 test375 test376 test378 test379 \ test380 test381 test383 test384 test385 test386 test387 test388 test389 \ test390 test391 test392 test393 test394 test395 test396 test397 test398 \ test399 test400 test401 test402 test403 test404 test405 test406 test407 \ -test408 test409 test410 test411 test412 test413 test414 test415 \ +test408 test409 test410 test411 test412 test413 test414 test415 test416 \ \ test430 test431 test432 test433 test434 test435 test436 \ \ diff --git a/tests/data/test416 b/tests/data/test416 new file mode 100644 index 0000000000..93dc067f2c --- /dev/null +++ b/tests/data/test416 @@ -0,0 +1,51 @@ + + + +FTP +EPSV +RETR +Range + + +# Server-side + + +0123456789abcdef0123456789abcdef0123456789abcdef + + +0123456789abcdef0123456789abcdef0123456789abcdef + + +RETRSIZE 7 + + +8 + + + +# Client-side + + +ftp + + +FTP growing file support + + +--ignore-content-length ftp://%HOSTIP:%FTPPORT/%TESTNUMBER + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +RETR %TESTNUMBER +QUIT + + + diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 422fdc2ccc..095e8b76e2 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -141,6 +141,7 @@ my $ctrldelay; # set if server should throttle ctrl stream my $datadelay; # set if server should throttle data stream my $retrweirdo; # set if ftp server should use RETRWEIRDO my $retrnosize; # set if ftp server should use RETRNOSIZE +my $retrsize; # set if ftp server should use RETRSIZE my $pasvbadip; # set if ftp server should use PASVBADIP my $nosave; # set if ftp server should not save uploaded data my $nodataconn; # set if ftp srvr doesn't establish or accepts data channel @@ -2343,6 +2344,9 @@ sub RETR_ftp { if($retrnosize) { $sz = "size?"; } + elsif($retrsize > 0) { + $sz = "($retrsize bytes)"; + } sendcontrol "150 Binary data connection for $testno () $sz.\r\n"; @@ -2795,6 +2799,7 @@ sub customize { $datadelay = 0; # default is no throttling of the data stream $retrweirdo = 0; # default is no use of RETRWEIRDO $retrnosize = 0; # default is no use of RETRNOSIZE + $retrsize = 0; # default is no use of RETRSIZE $pasvbadip = 0; # default is no use of PASVBADIP $nosave = 0; # default is to actually save uploaded data to file $nodataconn = 0; # default is to establish or accept data channel @@ -2862,6 +2867,10 @@ sub customize { logmsg "FTPD: instructed to use RETRNOSIZE\n"; $retrnosize=1; } + elsif($_ =~ /RETRSIZE (\d+)/) { + $retrsize= $1; + logmsg "FTPD: instructed to use RETRSIZE = $1\n"; + } elsif($_ =~ /PASVBADIP/) { logmsg "FTPD: instructed to use PASVBADIP\n"; $pasvbadip=1;