Re: FTP problem with LWP
Adam Clark (adamc@cnet.com)
Mon, 13 Jul 1998 14:38:39 -0700
This is a followup to my previous libwww-perl message regarding
LWP problems with FTP.
When LWP::UserAgent makes an ftp request, it ends by calling
Net::FTP::dataconn::close. That sub looks like this:
sub close
{
my $data = shift;
my $ftp = ${*$data}{'net_ftp_cmd'};
$data->_close;
$ftp->response() == CMD_OK &&
$ftp->message =~ /unique file name:\s*(\S*)\s*\)/ &&
(${*$ftp}{'net_ftp_unique'} = $1);
$ftp->status == CMD_OK;
}
Some ftp servers, however, don't seem to respond to the
$ftp->response() code, and the code is left in an infinite
while{} statement. Try running a request on
ftp://ftp.frii.com/pub/cmdline/12mon10.zip
to see this.
I've started overriding this sub in my code, by saying
sub Net::FTP::dataconn::close
{
my $data = shift;
my $ftp = ${*$data}{'net_ftp_cmd'};
$data->_close;
$ftp->status == CMD_OK;
}
(I'm not using any $ftp methods after this, so I just cut out
the whole post-close chunk -- YMMV)
My hack works for me, so I'm not planning to investigate this
further or come up with a proper solution. But I thought I'd
put out the word on this.
Adam