Commit 265bb993 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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.
parent 7493db23
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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

tests/data/test126

0 → 100644
+33 −0
Original line number Diff line number Diff line
# Server-side
<reply>
<data>
this is file contents
</data>
</reply>

# Client-side
<client>
 <name>
FTP download with multiple replies at once in RETR
 </name>
 <command>
ftp://%HOSTIP:%FTPPORT/blalbla/lululul/126
</command>
<file name="log/ftpserver.cmd">
RETRWEIRDO
</file>
</test>

# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD blalbla/lululul
EPSV
TYPE I
SIZE 126
RETR 126
</protocol>
</verify>
+27 −8
Original line number Diff line number Diff line
@@ -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,6 +227,19 @@ sub RETR_command {
            logmsg "REST $rest was removed from size, makes $size left\n";
            $rest = 0; # reset REST offset again
        }
        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;
            }
            close(SOCK);
            $retrweirdo=0; # switch off the weirdo again!
        }
        else {
            print "150 Binary data connection for $testno () ($size bytes).\r\n";
            logmsg "150 Binary data connection for $testno ($size bytes).\n";

@@ -237,6 +251,7 @@ sub RETR_command {

            print "226 File transfer complete\r\n";
        }
    }
    else {
        print "550 $testno: No such file or directory.\r\n";
        logmsg "550 $testno: no such file\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);
}