summaryrefslogtreecommitdiff
path: root/lib/Net/FTP/A.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/FTP/A.pm')
-rw-r--r--lib/Net/FTP/A.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Net/FTP/A.pm b/lib/Net/FTP/A.pm
index d0688280fc..44b9cdb0fa 100644
--- a/lib/Net/FTP/A.pm
+++ b/lib/Net/FTP/A.pm
@@ -10,7 +10,7 @@ use Carp;
require Net::FTP::dataconn;
@ISA = qw(Net::FTP::dataconn);
-$VERSION = "1.16";
+$VERSION = "1.17";
sub read {
my $data = shift;
@@ -71,7 +71,10 @@ sub write {
my $size = shift || croak 'write($buf,$size,[$timeout])';
my $timeout = @_ ? shift : $data->timeout;
- (my $tmp = substr($buf,0,$size)) =~ s/\r?\n/\015\012/sg;
+ my $nr = (my $tmp = substr($buf,0,$size)) =~ tr/\r\n/\015\012/;
+ $tmp =~ s/[^\015]\012/\015\012/sg if $nr;
+ $tmp =~ s/^\012/\015\012/ unless ${*$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
# when we write. This can happen if the disk on the remote server fills up