In the process of writing a Perl script to synchronize a local directory with a remote directory. Finally found a way to connect to external FTP server through the ftp proxy.
The ftp proxy server that I am using requires a "user after logon" method. Because the ftp proxy needs the user to be authenticated, Perl's Net::FTP supports it in a stupid way. A .netrc file has to be created at the user's home directory with the ftp proxy username and pasword in it. The content of the .netrc has the followings
machine ftpproxy.sailor.com
login fwuser
password fwpass
The Perl script will be
$ftp = Net::FTP->new("ftp.microsoft.com",Timeout=>240,
Firewall=>"ftpproxy.sailor.com",FirewallType=>2);
$ftp->login("user","pass")
I do not like the user name and password to be kept in ~/.netrc. I am using something like the followings.
$ftp = Net::FTP->new("ftpproxy.sailor.com",Timeout=>240);
$ftp->command("user","fwuser");
$ok = $ftp->response();
$ftp->command("PASS","fwpass");
$ok = $ftp->response();
$ftp->command("user","user@ftp.microsoft.com");
$ok = $ftp->response();
$ftp->command("PASS","pass");
$ok = $ftp->response();