about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-01-03 17:41:55 +0000
committerSteve Hay <steve.m.hay@googlemail.com>2014-01-03 17:41:55 +0000
commit24eb8619451c3d8529d903d9133d03a7f447488f (patch)
tree7c7c4888070fc7f4754964dcf2c0951f1ebe2071
parentdbaaec8341d33295fa84818acc941f46bd3e642c (diff)
downloadperl-libnet-24eb8619451c3d8529d903d9133d03a7f447488f.tar.gz
Fix incorrect handling of CRLF in Net::FTP
Patch by Willem Monsuwé from CPAN RT#62029 (plus $VERSION bump).
-rw-r--r--Changes2
-rw-r--r--Net/FTP/A.pm6
2 files changed, 5 insertions, 3 deletions
diff --git a/Changes b/Changes
index e8ef612..44d6772 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,6 @@
 
+  * Fix incorrect handling of CRLF in Net::FTP [Willem Monsuwé; resolves CPAN
+    RT#41642/62029]
   * POD fixes [Dominic Hargreaves; resolves CPAN RT#91761]
 
 libnet 1.23  -- Mon Aug 12 2013
diff --git a/Net/FTP/A.pm b/Net/FTP/A.pm
index 427d02b..c117d69 100644
--- a/Net/FTP/A.pm
+++ b/Net/FTP/A.pm
@@ -10,7 +10,7 @@ use Carp;
 require Net::FTP::dataconn;
 
 @ISA     = qw(Net::FTP::dataconn);
-$VERSION = "1.18";
+$VERSION = "1.19";
 
 
 sub read {
@@ -77,8 +77,8 @@ sub write {
   my $timeout = @_ ? shift: $data->timeout;
 
   my $nr = (my $tmp = substr($buf, 0, $size)) =~ tr/\r\n/\015\012/;
-  $tmp =~ s/([^\015])\012/$1\015\012/sg if $nr;
-  $tmp =~ s/^\012/\015\012/ unless ${*$data}{'net_ftp_outcr'};
+  $tmp =~ s/(?<!\015)\012/\015\012/sg if $nr;
+  $tmp =~ s/^\015// if ${*$data}{'net_ftp_outcr'};
   ${*$data}{'net_ftp_outcr'} = substr($tmp, -1) eq "\015";
 
   # If the remote server has closed the connection we will be signal'd