可以在https上的WWW :: Mechanize中使用超时吗? [英] Possible to use timeout in WWW::Mechanize on https?

查看:194
本文介绍了可以在https上的WWW :: Mechanize中使用超时吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用 WWW的Perl脚本: :机械化使用WWW :: Mechanize中的POST操作通过我们的公司代理从安全(https)网站下载内容。

We have a Perl script which uses WWW::Mechanize to download content from a secured (https) website via our company proxy using POST action in WWW::Mechanize.

有时这个帖子动作会因为未知原因而持续数小时。

Sometimes this post action runs for hours for unknown reasons.

我想控制它。我检查了超时,但我也在Stackoverflow中的一篇文章中读到它与https网站不兼容。

I want to control this. I checked for timeout but I also read in one of the post in Stackoverflow that it does not work with https websites.

我知道如何使用超时机制吗?

Any idea how I can use the timeout mechanism?

我想停止处理该链接,说一分钟左右后继续进行,而不是一起等待几个小时。任何帮助都会非常感激。

I want to stop processing that link say after a minute or so to proceed further and not wait for hours together. Any help would be really appreciated.

推荐答案

使用 LWPx :: ParanoidAgent 并将其混合到Mech中。

Use LWPx::ParanoidAgent and mix it into Mech.


$ua->timeout(10);

从开始到结束,总共10秒。不只是在
套接字读取之间。它包括所有重定向。所以攻击者告诉
你从恶意的tarpit网络服务器上下载只能在$ n秒内停止

this is 10 seconds overall, from start to finish. not just between socket reads. and it includes all redirects. so attackers telling you to download from a malicious tarpit webserver can only stall you for $n seconds

这篇关于可以在https上的WWW :: Mechanize中使用超时吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆