Timeout for LWP request

戏子无情 提交于 2019-12-25 04:33:05

问题


I'm creating a user agent using LWP::UserAgent. I want to timeout $ua->request(). how can I do that?

my $ua = LWP::UserAgent->new();
my $request = HTTP::Request->new(DELETE => $url);
$req->authorization_basic($user, $pwd);
my $response = $ua->request($req);

I know LWP has time out, but according to the documentation

The requests is aborted if no activity on the connection to the server is observed for timeout seconds. This means that the time it takes for the complete transaction and the request() method to actually return might be longer.

来源:https://stackoverflow.com/questions/34793425/timeout-for-lwp-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!