#!/usr/bin/perl -w
$| = 1;
use LWP::UserAgent;
$UserAgent = new LWP::UserAgent;
$UserAgent->timeout(60);
$UserAgent->proxy( 'http', 'http://204.134.208.33:80/' );
local $SIG{ALRM} = sub {
print "timed out!\n";
die;
};
my $request = new HTTP::Request('GET', 'http://www.ru/' );
print "Connecting ... ";
alarm 60;
my $response = $UserAgent->request ( $request );
alarm 0;
print "done.\n";
print $response->code,"; ",$response->message,"\n";
----- Original Message -----
From: Tatarskih Denis <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 05, 2000 7:06 PM
Subject: Troubles with timeout
Hi, all!
I have problem with timeout in lwp:
few time ago i install libwww-perl v. 5.48 ( old version was 5.46 )
So, if I set $UserAgent->timeout to 60 seconds and then connect via
probably unreachable proxy ( http://204.134.208.33:80/ ), I wait about 13
minutes for recieving response '500 Couldn't connect ( Connection timed out )'
This simple program is in attachment
Could somebody help me about this problem?