Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This took just over 3 minutes (default timeout). Why didn't the timeout of 10 seconds kick in?
Note I cannot reproduce as the internal server error is fixed, but I want to avoid the lengthy timeout in future
Using perl 5.8.0, here is code snippet:
my $method = 'POST'; my $url = "https://etc"; # note: actual url not shown here my $query_string = ""; # note: actual query string not shown here my $ua = new LWP::UserAgent; $ua->timeout(10); $ua->agent('Mozilla/4.6'); $ua->cookie_jar(HTTP::Cookies->new); $request = new HTTP::Request($method,$url); $request->content_type('application/x-www-form-urlencoded'); $request->content($query_string); $response_content = $ua->request($request)->content; LWP::Debug::debug("Response:\n$response_content\n");
Debug messages are as follows:
LWP::UserAgent::new: () LWP::UserAgent::proxy: LWP::UserAgent::request: () LWP::UserAgent::send_request: POST <URL here> LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::UserAgent::request: Simple response: Internal Server Error Response: 500 Connect failed: connect: Connection timed out; Connection timed ou +t
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent request ignores timeout when internal server error encountered
by thanos1983 (Parson) on Aug 14, 2018 at 12:06 UTC | |
by Anonymous Monk on Aug 14, 2018 at 13:58 UTC | |
by hippo (Archbishop) on Aug 14, 2018 at 14:22 UTC | |
|
Re: LWP::UserAgent request ignores timeout when internal server error encountered
by sectokia (Friar) on Aug 14, 2018 at 12:41 UTC |