about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2008-02-10 00:39:36 +0000
committerGraham Barr <gbarr@pobox.com>2009-02-24 10:40:49 -0600
commit0d616e68ccd1acba2203847af1c6b59f8134e37f (patch)
tree7bdb9ba2a7e744c93f93e21184b4e5d35cc2144b
parent294c44c5961c6a7fa973b3b32b40099040a81684 (diff)
downloadperl-libnet-0d616e68ccd1acba2203847af1c6b59f8134e37f.tar.gz
Send ALLO command just before the store command
-rw-r--r--Net/FTP.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index 8096c43..ee31441 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -711,7 +711,7 @@ sub _store_cmd {
     # a pipe, or device) and if so get the file size from stat, and send
     # an ALLO command before sending the STOR, STOU, or APPE command.
     my $size = do { local $^W; -f $local && -s _ };    # no ALLO if sending data from a pipe
-    $ftp->_ALLO($size) if $size;
+    ${*$ftp}{'net_ftp_allo'} = $size if $size;
   }
   croak("Bad remote filename '$remote'\n")
     if defined($remote) and $remote =~ /[\r\n]/s;
@@ -1043,6 +1043,11 @@ sub _data_cmd {
   return undef
     unless $ok;
 
+  if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo}) {
+    $ftp->_ALLO(delete ${*$ftp}{net_ftp_allo})
+      or return undef;
+  }
+
   $ftp->command($cmd, @_);
 
   return 1