From: Gisle Aas Date: Fri, 27 Jan 2006 07:21:16 +0000 (-0800) Subject: Re: Make Passive mode the default for Net::FTP X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8460ac15db2c40d1c6f63e30e61207343dddc0f6;p=p5sagit%2Fp5-mst-13.2.git Re: Make Passive mode the default for Net::FTP Message-ID: p4raw-id: //depot/perl@26970 --- diff --git a/lib/Net/Config.pm b/lib/Net/Config.pm index a502abe..185f292 100644 --- a/lib/Net/Config.pm +++ b/lib/Net/Config.pm @@ -27,8 +27,8 @@ eval { local $SIG{__DIE__}; require Net::LocalCfg }; time_hosts => [], inet_domain => undef, ftp_firewall => undef, - ftp_ext_passive => 0, - ftp_int_passive => 0, + ftp_ext_passive => 1, + ftp_int_passive => 1, test_hosts => 1, test_exist => 1, ); @@ -269,11 +269,12 @@ There is no firewall =item ftp_int_passive -FTP servers normally work on a non-passive mode. That is when you want to -transfer data you have to tell the server the address and port to -connect to. +FTP servers can work in passive or active mode. Active mode is when +you want to transfer data you have to tell the server the address and +port to connect to. Passive mode is when the server provide the +address and port and you establish the connection. -With some firewalls this does not work as the server cannot +With some firewalls active mode does not work as the server cannot connect to your machine (because you are behind a firewall) and the firewall does not re-write the command. In this case you should set C to a I value. diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm index 7dfe0ab..6b15b9c 100644 --- a/lib/Net/FTP.pm +++ b/lib/Net/FTP.pm @@ -1332,10 +1332,18 @@ B - Set a timeout value (defaults to 120) B - debug level (see the debug method in L) -B - If set to a non-zero value then all data transfers will be done -using passive mode. This is not usually required except for some I -servers, and some firewall configurations. This can also be set by the -environment variable C. +B - If set to a non-zero value then all data transfers will +be done using passive mode. If set to zero then data transfers will be +done using active mode. If the machine is connected to the Internet +directly, both passive and active mode should work equally well. +Behind most firewall and NAT configurations passive mode has a better +chance of working. However, in some rare firewall configurations, +active mode actually works when passive mode doesn't. Some really old +FTP servers might not implement passive transfers. If not specified, +then the transfer mode is set by the environment variable +C or if that one is not set by the settings done by the +F utility. If none of these apply then passive mode is +used. B - If given a reference to a file handle (e.g., C<\*STDERR>), print hash marks (#) on that filehandle every 1024 bytes. This