From 07f98d3619a82d4011c8998d33de7eba7d191b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Thu, 8 Dec 2016 10:11:15 +0100 Subject: [PATCH] Add timeout to `web title` command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- plugins/Web/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index 7e08d5d19..aab7885c5 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -147,7 +147,9 @@ class Web(callbacks.PluginRegexp): def getTitle(self, irc, url, raiseErrors): size = conf.supybot.protocols.http.peekSize() - (target, text) = utils.web.getUrlTargetAndContent(url, size=size) + timeout = self.registryValue('timeout') + (target, text) = utils.web.getUrlTargetAndContent(url, size=size, + timeout=timeout) try: text = text.decode(utils.web.getEncoding(text) or 'utf8', 'replace')