LWP::UserAgent and timeout()
Randall Perlow (bpvaunt@vaunt.com)
Wed, 17 Mar 1999 03:58:05 +0000
Hi,
I've been playing with LWP 5.36 for a few months and the library's
great. Recently however I ran into a problem with the timeout() call.
The request doesn't seem to timeout as expected.
Here's a simple script I tried to a known invalid address, and the
response that I received. Although I set the timeout to 10 seconds, the
request hangs for over 3 minutes (the default timeout).
I also noticed that the loadmeter becomes pegged while the script is
running. Can anyone tell me what I'm doing wrong?
Thanks in advance.
-Randy Perlow
----
# test.pl
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use strict;
my $ua = new LWP::UserAgent 'Test', 'bpvaunt@vaunt.com';
$ua->timeout(10);
my $request = new HTTP::Request 'GET', 'http://128.0.0.2';
my $response = $ua->request($request);
print $response->as_string;
----
> time test.pl
500 (Internal Server Error) Can't connect to 128.0.0.2:80 (Connection
timed out)
Client-Date: Wed, 17 Mar 1999 02:30:54 GMT
0.690u 0.030s 3:09.85 0.3% 0+0k 0+0io 276pf+0w