]> granicus.if.org Git - curl/commitdiff
Make the SLOWDOWN option slow the FTP data connection, not just the
authorDan Fandrich <dan@coneharvesters.com>
Thu, 6 Nov 2008 00:10:58 +0000 (00:10 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 6 Nov 2008 00:10:58 +0000 (00:10 +0000)
control connection.

tests/ftpserver.pl

index 52092337d5de67f9b57e542ce3479089c27f669a..7a2ffe5299d1bdd5a55ad7eb63b12c308358d433 100644 (file)
@@ -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);
+          }
+      }
     }
 }