X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FNet%2FFTP.pm;h=4e09b59d02537aeb7bcc307b501fa250cb01e598;hb=edd55068839c345dfb2c25887f70d5c69e05b5d3;hp=999889772dc4877e51ecb35ddd5f73cf7b31750d;hpb=6c941e0cc3f0f3bcc43af75928ecabd63f9b41f6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm index 9998897..4e09b59 100644 --- a/lib/Net/FTP.pm +++ b/lib/Net/FTP.pm @@ -22,7 +22,7 @@ use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); # use AutoLoader qw(AUTOLOAD); -$VERSION = "2.65"; # $Id: //depot/libnet/Net/FTP.pm#68 $ +$VERSION = "2.67"; # $Id: //depot/libnet/Net/FTP.pm#70 $ @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -76,6 +76,7 @@ sub new my $ftp = $pkg->SUPER::new(PeerAddr => $peer, PeerPort => $arg{Port} || 'ftp(21)', + LocalAddr => $arg{'LocalAddr'}, Proto => 'tcp', Timeout => defined $arg{Timeout} ? $arg{Timeout} @@ -86,6 +87,8 @@ sub new ${*$ftp}{'net_ftp_type'} = 'A'; # ASCII/binary/etc mode ${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240); + ${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'}; + ${*$ftp}{'net_ftp_firewall'} = $fire if(defined $fire); ${*$ftp}{'net_ftp_firewall_type'} = $fire_type @@ -714,6 +717,9 @@ sub _store_cmd $sock = $ftp->_data_cmd($cmd, $remote) or return undef; + $remote = ($ftp->message =~ /FILE:\s*(.*)/)[0] + if 'STOU' eq uc $cmd; + my $blksize = ${*$ftp}{'net_ftp_blksize'}; my($count,$hashh,$hashb,$ref) = (0); @@ -908,6 +914,7 @@ sub _dataconn $data = $pkg->new(PeerAddr => join(".",@port[0..3]), PeerPort => $port[4] * 256 + $port[5], + LocalAddr => ${*$ftp}{'net_ftp_localaddr'}, Proto => 'tcp' ); } @@ -1277,6 +1284,9 @@ simply invokes the C method for you, so that hash marks are displayed for all transfers. You can, of course, call C explicitly whenever you'd like. +B - Local address to use for all socket connections, this +argument will be passed to L + If the constructor fails undef will be returned and an error message will be in $@ @@ -1710,6 +1720,6 @@ under the same terms as Perl itself. =for html
-I<$Id: //depot/libnet/Net/FTP.pm#68 $> +I<$Id: //depot/libnet/Net/FTP.pm#70 $> =cut