From 464be27479925e727eea688da93704aff7e17a1e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 23 Aug 2004 14:40:43 +0000 Subject: Provide support for "transferring" zero bytes FTP files and comparing that the output file actually is zero bytes after the transfer. --- tests/FILEFORMAT | 8 ++++++-- tests/ftpserver.pl | 4 +++- tests/runtests.pl | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index 2ccd45f5f..e7245bc3f 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -14,8 +14,8 @@ specified, that will be checked/used if specified. This document includes all the subsections currently supported. - -data to sent to the client on its request and later verified that it arrived + +§data to sent to the client on its request and later verified that it arrived safely. Set the nocheck=1 to prevent the test script to verify the arrival of this data. @@ -27,6 +27,10 @@ If the data contains 'swsbounce' anywhere within the start and end tag, the HTTP server will detect if this is a second request using the same test and part number and will then increase the part number with one. This is useful for auth tests and similar. + +'sendzero' set to yes means that the (FTP) server will "send" the data even if +the size is zero bytes. Used to verify curl's behaviour on zero bytes +transfers. Send back this contents instead of the one. The num is set by: diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 9a171331c..af79fc5d3 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -318,7 +318,9 @@ sub RETR_command { $size += length($_); } - if($size) { + my %hash = getpartattr("reply", "data"); + + if($size || $hash{'sendzero'}) { if($rest) { # move read pointer forward diff --git a/tests/runtests.pl b/tests/runtests.pl index 526d331e6..18b7e83ef 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1147,7 +1147,7 @@ sub singletest { } my %replyattr = getpartattr("reply", "data"); - if(!$replyattr{'nocheck'} && @reply) { + if(!$replyattr{'nocheck'} && (@reply || $replyattr{'sendzero'})) { # verify the received data my @out = loadarray($CURLOUT); $res = compare("data", \@out, \@reply); -- cgit v1.2.3