From 265bb993829018e6cac32b9c3f9dd6f2c5c2e662 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 3 Dec 2001 13:46:56 +0000 Subject: [PATCH] test case 126 added, this uses RETRWEIRDO that makes the FTP server send two responses at once, to excerise the part of curl to make sure it can cache (parts of) responses properly. --- tests/data/Makefile.am | 2 +- tests/data/test126 | 33 +++++++++++++++++++++++++++++++++ tests/ftpserver.pl | 33 ++++++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 tests/data/test126 diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 71e0a60f5..575c1ecb9 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -14,4 +14,4 @@ test103 test112 test121 test17 test22 test300 test401 test8 \ test104 test113 test122 test18 test23 test301 test402 test9 \ test105 test114 test123 test19 test24 test302 test43 \ test106 test115 test124 test190 test25 test303 test44 \ -test107 test116 test125 test2 test26 test33 test45 +test107 test116 test125 test2 test26 test33 test45 test126 diff --git a/tests/data/test126 b/tests/data/test126 new file mode 100644 index 000000000..55abb5af6 --- /dev/null +++ b/tests/data/test126 @@ -0,0 +1,33 @@ +# Server-side + + +this is file contents + + + +# Client-side + + +FTP download with multiple replies at once in RETR + + +ftp://%HOSTIP:%FTPPORT/blalbla/lululul/126 + + +RETRWEIRDO + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS curl_by_daniel@haxx.se +PWD +CWD blalbla/lululul +EPSV +TYPE I +SIZE 126 +RETR 126 + + diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index beae5fa14..c0094b3a9 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -26,6 +26,7 @@ sub logmsg { print FTPLOG "$$: "; print FTPLOG @_; } sub ftpmsg { print INPUT @_; } my $verbose=0; # set to 1 for debugging +my $retrweirdo=0; my $port = 8921; # just a default do { @@ -226,16 +227,30 @@ sub RETR_command { logmsg "REST $rest was removed from size, makes $size left\n"; $rest = 0; # reset REST offset again } - print "150 Binary data connection for $testno () ($size bytes).\r\n"; - logmsg "150 Binary data connection for $testno ($size bytes).\n"; + if($retrweirdo) { + print "150 Binary data connection for $testno () ($size bytes).\r\n", + "226 File transfer complete\r\n"; + logmsg "150+226 in one shot!\n"; - for(@data) { - my $send = $_; - print SOCK $send; + for(@data) { + my $send = $_; + print SOCK $send; + } + close(SOCK); + $retrweirdo=0; # switch off the weirdo again! } - close(SOCK); + else { + print "150 Binary data connection for $testno () ($size bytes).\r\n"; + logmsg "150 Binary data connection for $testno ($size bytes).\n"; - print "226 File transfer complete\r\n"; + for(@data) { + my $send = $_; + print SOCK $send; + } + close(SOCK); + + print "226 File transfer complete\r\n"; + } } else { print "550 $testno: No such file or directory.\r\n"; @@ -367,6 +382,10 @@ sub customize { elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) { $delayreply{$1}=$2; } + elsif($_ =~ /RETRWEIRDO/) { + print "instructed to use RETRWEIRDO\n"; + $retrweirdo=1; + } } close(CUSTOM); }