mirror of https://github.com/moparisthebest/curl
make the ftp server support reply/servercmd, and make SLOWDOWN work, and
update the docs accordingly
This commit is contained in:
parent
e9d068b913
commit
cd1144dc24
|
@ -57,18 +57,22 @@ number to return on a ftp SIZE command (set to -1 to make this command fail)
|
||||||
what to send back if the client sends a (FTP) MDTM command, set to -1 to
|
what to send back if the client sends a (FTP) MDTM command, set to -1 to
|
||||||
have it return that the file doesn't exist
|
have it return that the file doesn't exist
|
||||||
</mdtm>
|
</mdtm>
|
||||||
<servercmd>
|
|
||||||
special purpose server-command to control its behavior *before* the
|
|
||||||
reply is sent:
|
|
||||||
|
|
||||||
auth_required - server fails if no auth is provided
|
|
||||||
</servercmd>
|
|
||||||
<postcmd>
|
<postcmd>
|
||||||
special purpose server-command to control its behavior *after* the
|
special purpose server-command to control its behavior *after* the
|
||||||
reply is sent
|
reply is sent
|
||||||
</postcmd>
|
</postcmd>
|
||||||
<servercmd>
|
<servercmd>
|
||||||
equivalent to <cmd> but for HTTP, one specified command is supported:
|
Special-commands for the server.
|
||||||
|
For FTP, these are supported:
|
||||||
|
REPLY
|
||||||
|
COUNT
|
||||||
|
DELAY
|
||||||
|
RETRWEIRDO
|
||||||
|
RETRNOSIZE
|
||||||
|
NOSAVE
|
||||||
|
SLOWDOWN
|
||||||
|
|
||||||
|
For HTTP, one specified command is supported:
|
||||||
"auth_required" - if this is set and a POST/PUT is made without auth, the
|
"auth_required" - if this is set and a POST/PUT is made without auth, the
|
||||||
server will NOT wait for the full request body to get sent
|
server will NOT wait for the full request body to get sent
|
||||||
</servercmd>
|
</servercmd>
|
||||||
|
|
|
@ -118,7 +118,7 @@ sub sendcontrol {
|
||||||
|
|
||||||
for(@a) {
|
for(@a) {
|
||||||
print $_;
|
print $_;
|
||||||
select(undef, undef, undef, 0.1);
|
select(undef, undef, undef, 0.02);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,6 +544,7 @@ sub customize {
|
||||||
undef %customreply;
|
undef %customreply;
|
||||||
|
|
||||||
$nosave = 0; # default is to save as normal
|
$nosave = 0; # default is to save as normal
|
||||||
|
$controldelay = 0; # default is no delaying the responses
|
||||||
|
|
||||||
open(CUSTOM, "<log/ftpserver.cmd") ||
|
open(CUSTOM, "<log/ftpserver.cmd") ||
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -565,6 +566,10 @@ sub customize {
|
||||||
$delayreply{$1}=$2;
|
$delayreply{$1}=$2;
|
||||||
logmsg "FTPD: delay reply for $1 with $2 seconds\n";
|
logmsg "FTPD: delay reply for $1 with $2 seconds\n";
|
||||||
}
|
}
|
||||||
|
elsif($_ =~ /SLOWDOWN/) {
|
||||||
|
$controldelay=1;
|
||||||
|
logmsg "FTPD: send response with 0.1 sec delay between each byte\n";
|
||||||
|
}
|
||||||
elsif($_ =~ /RETRWEIRDO/) {
|
elsif($_ =~ /RETRWEIRDO/) {
|
||||||
logmsg "FTPD: instructed to use RETRWEIRDO\n";
|
logmsg "FTPD: instructed to use RETRWEIRDO\n";
|
||||||
$retrweirdo=1;
|
$retrweirdo=1;
|
||||||
|
|
|
@ -1067,8 +1067,8 @@ sub singletest {
|
||||||
# if this section exists, we verify upload
|
# if this section exists, we verify upload
|
||||||
my @upload = getpart("verify", "upload");
|
my @upload = getpart("verify", "upload");
|
||||||
|
|
||||||
# if this section exists, it is FTP server instructions:
|
# if this section exists, it might be FTP server instructions:
|
||||||
my @ftpservercmd = getpart("server", "instruction");
|
my @ftpservercmd = getpart("reply", "servercmd");
|
||||||
|
|
||||||
my $CURLOUT="$LOGDIR/curl$testnum.out"; # curl output if not stdout
|
my $CURLOUT="$LOGDIR/curl$testnum.out"; # curl output if not stdout
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue