cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 2/4] ftpserver.pl: directory LISTings use [CR][LF] for ASCII transfer

From: Marc Hoersken <info_at_marc-hoersken.de>
Date: Sun, 26 Jan 2014 11:30:41 +0100

According to section 2.2 of RFC959 the End-of-Line is defined as:
 The end-of-line sequence defines the separation of printing
 lines. The sequence is Carriage Return, followed by Line Feed.

Verified by sniffing traffic between a Windows FTP client (FileZilla)
and Unix-hosted FTP server (ProFTPD).

---
 tests/ftpserver.pl | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index f2b12eb..0116e20 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -2160,6 +2160,9 @@ my @ftpdir=("total 20\r\n",
         my @data = getpart("reply", "data");
         for(@data) {
             my $send = $_;
+            # convert all \n to \r\n for ASCII transfer
+            $send =~ s/\r\n/\n/g;
+            $send =~ s/\n/\r\n/g;
             logmsg "send $send as data\n";
             senddata $send;
         }
-- 
1.8.1.msysgit.1
--------------010500040702000407000504
Content-Type: text/plain; charset=windows-1252;
 name="0003-runtests.pl-added-support-for-text-mode-within-datac.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0003-runtests.pl-added-support-for-text-mode-within-datac.pa";
 filename*1="tch"
Received on 2001-09-17