[Israel.pm] LWP black magic
eli at billauer.co.il
Tue Oct 14 09:23:24 PDT 2008
I'm having a strange problem with LWP. The requests consistently time
out on a specific URL, even though the sniffer clearly shows that the
data came in completely, and that FINs went in both directions and was
acknowledged by the host running the script. The Perl version is 5.8.8
The data is textual, from a Microsoft server, and hence there are LF/CR
line terminations. The last line ends without any LF nor CR.
The really weird thing, is that /usr/bin/GET (which is also based upon
LWP) works like a charm, returning a chunk of data matching the HTTP
answer's Content-Length header precisely.
The timeout is for real: Nothing happens for a period of time which is
much longer than it took GET to grab the data.
Even more weird, exactly the same script has run for a long time
perfectly on a remote host, also running Perl 5.8.8 under Linux.
Did I say weird?
Any idea what could be happening here?
The relevant snip follows.
Thanks in advance,
my $url = 'http://something';
my $ua = LWP::UserAgent->new();
$ua->agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
More information about the Perl