aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-11-06 00:10:58 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-11-06 00:10:58 +0000
commit4d50b9f1f1aa95e8081bf4d6dbb515ea3170c709 (patch)
tree6de5d3c12efb011776e4bc1e1679aaadc024dfb9 /tests
parent5e3c2af2361fbf0b3f1641945b77fc93fedfec38 (diff)
Make the SLOWDOWN option slow the FTP data connection, not just the
control connection.
Diffstat (limited to 'tests')
-rw-r--r--tests/ftpserver.pl22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 52092337d..7a2ffe529 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -207,6 +207,15 @@ sub sockfilt {
}
+sub sockfiltsecondary {
+ my $l;
+ foreach $l (@_) {
+ printf DWRITE "DATA\n%04x\n", length($l);
+ print DWRITE $l;
+ }
+}
+
+
# Send data to the client on the control stream, which happens to be plain
# stdout.
@@ -237,8 +246,17 @@ sub sendcontrol {
sub senddata {
my $l;
foreach $l (@_) {
- printf DWRITE "DATA\n%04x\n", length($l);
- print DWRITE $l;
+ if(!$controldelay) {
+ # spit it all out at once
+ sockfiltsecondary $l;
+ }
+ else {
+ # pause between each byte
+ for (split(//,$l)) {
+ sockfiltsecondary $_;
+ select(undef, undef, undef, 0.01);
+ }
+ }
}
}