CC: | #CBG dev <#CBGdev [...] OptimalPayments.com> |
Subject: | Net::FTP unable to set local port for "active" mode connections |
Date: | Tue, 1 Oct 2013 14:00:16 +0100 |
To: | "bug-libnet [...] rt.cpan.org" <bug-libnet [...] rt.cpan.org> |
From: | Rimantas Cernauskas <Rimantas.Cernauskas [...] netbanx.com> |
Net::FTP 2.77
Perl v5.16.3
Linux 2.6.18-348.12.1.el5
Our application is behind the firewall and one of our providers insisted on having "active" FTP connection for files upload. Due to security reasons, operations requested to use static port for incoming data connection from FTP server, which is usually supported by sending PORT command to FTP server, however Net::FTP is not creating socket if you issue $ftp->port("xxx,xxx,xxx,xxx,aa,bb") command.
I've modified Net::FTP to allow this functionallity ( https://github.com/gbarr/perl-libnet/pull/7 )
This change introduces method set_local_port($IntPortNumber). It's also being called by constructor if LocalPort is specified, so it can be used by wrappers like Net::FTP::AutoReconnect.
Bear in mind, that value for set_local_port is decimal port number to be used by IO::Socket.
Reuse option will be automatically set for IO::Socket constructor.
Any comments or suggestions are very welcome.
Thanks,
Rimantas Cernauskas