mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
improved functionality for new timeout tests
This commit is contained in:
parent
f34573c8e2
commit
3bfa06c9a2
@ -23,6 +23,14 @@ if the data is sent but this is what should be checked afterwards
|
|||||||
<size>
|
<size>
|
||||||
number to return on a ftp SIZE command
|
number to return on a ftp SIZE command
|
||||||
</size>
|
</size>
|
||||||
|
<cmd>
|
||||||
|
special purpose server-command to control its behavior *before* the
|
||||||
|
reply is sent
|
||||||
|
</cmd>
|
||||||
|
<postcmd>
|
||||||
|
special purpose server-command to control its behavior *after* the
|
||||||
|
reply is sent
|
||||||
|
</oistcmd>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
<client>
|
<client>
|
||||||
|
@ -326,6 +326,7 @@ sub PORT_command {
|
|||||||
$SIG{CHLD} = \&REAPER;
|
$SIG{CHLD} = \&REAPER;
|
||||||
|
|
||||||
my %customreply;
|
my %customreply;
|
||||||
|
my %delayreply;
|
||||||
sub customize {
|
sub customize {
|
||||||
undef %customreply;
|
undef %customreply;
|
||||||
open(CUSTOM, "<log/ftpserver.cmd") ||
|
open(CUSTOM, "<log/ftpserver.cmd") ||
|
||||||
@ -337,6 +338,9 @@ sub customize {
|
|||||||
if($_ =~ /REPLY ([A-Z]+) (.*)/) {
|
if($_ =~ /REPLY ([A-Z]+) (.*)/) {
|
||||||
$customreply{$1}=$2;
|
$customreply{$1}=$2;
|
||||||
}
|
}
|
||||||
|
elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) {
|
||||||
|
$delayreply{$1}=$2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(CUSTOM);
|
close(CUSTOM);
|
||||||
}
|
}
|
||||||
@ -416,6 +420,12 @@ for ( $waitedpid = 0;
|
|||||||
$state = $newstate;
|
$state = $newstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $delay = $delayreply{$FTPCMD};
|
||||||
|
if($delay) {
|
||||||
|
# just go sleep this many seconds!
|
||||||
|
sleep($delay);
|
||||||
|
}
|
||||||
|
|
||||||
my $text;
|
my $text;
|
||||||
$text = $customreply{$FTPCMD};
|
$text = $customreply{$FTPCMD};
|
||||||
my $fake = $text;
|
my $fake = $text;
|
||||||
|
@ -50,6 +50,16 @@ sub REAPER {
|
|||||||
logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
|
logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub performcmd {
|
||||||
|
my @cmd = @_;
|
||||||
|
for(@cmd) {
|
||||||
|
if($_ =~ /^ *wait *(\d*)/) {
|
||||||
|
# instructed to sleep!
|
||||||
|
sleep($1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$SIG{CHLD} = \&REAPER;
|
$SIG{CHLD} = \&REAPER;
|
||||||
|
|
||||||
for ( $waitedpid = 0;
|
for ( $waitedpid = 0;
|
||||||
@ -164,6 +174,14 @@ for ( $waitedpid = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadtest("data/test$testnum");
|
loadtest("data/test$testnum");
|
||||||
|
|
||||||
|
|
||||||
|
my @cmd = getpart("reply", "cmd");
|
||||||
|
performcmd(@cmd);
|
||||||
|
|
||||||
|
# flush data:
|
||||||
|
$| = 1;
|
||||||
|
|
||||||
# send a custom reply to the client
|
# send a custom reply to the client
|
||||||
my @data = getpart("reply", "data$part");
|
my @data = getpart("reply", "data$part");
|
||||||
for(@data) {
|
for(@data) {
|
||||||
@ -172,6 +190,8 @@ for ( $waitedpid = 0;
|
|||||||
print STDERR "OUT: $_";
|
print STDERR "OUT: $_";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
my @postcmd = getpart("reply", "postcmd");
|
||||||
|
performcmd(@postcmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# print "Hello there, $name, it's now ", scalar localtime, "\r\n";
|
# print "Hello there, $name, it's now ", scalar localtime, "\r\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user