szekszardi has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I make HTTP requests using LWP::UserAgent and HTTP::Request. I set the timeout to 20 with $ua->timeout(20). If I do a print $ua->timeout(), it shows, that it has been set to 20 sec. The strange thing is that it is not working. I make a HTTP request to a server, but the request does not time out after 20 sec, instead it waits for more than ten minutes. Could anybody please help me with this? I would really apreciate a fast reply...

Regards,

Peter
  • Comment on LWP::UserAgent-timeout() - is it working?

Replies are listed 'Best First'.
Re: LWP::UserAgent-timeout() - is it working?
by tomhukins (Curate) on May 10, 2001 at 17:13 UTC
    I just typed LWP timeout problem into the search box that appears at the top of every page on Perl Monks, and found LWP - timeout, which explains some reasons why you might encounter timeout problems.
Re: LWP::UserAgent-timeout() - is it working?
by no_slogan (Deacon) on May 10, 2001 at 21:48 UTC
    Reading through the LWP code, it appears that timeout is actually the maximum length of time between packets, not for the complete request to finish. So if the server keeps sending you one byte every 10 seconds, LWP will wait pretty much forever. This is not at all clear from the documentation.