From d575c0d6d326112d1398997de669644afc67b23a Mon Sep 17 00:00:00 2001 From: nemunaire Date: Fri, 25 Jul 2014 12:52:10 +0200 Subject: [PATCH] tools.web: Avoid explicit redirection loop --- tools/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/web.py b/tools/web.py index 4a59878..7678a7d 100644 --- a/tools/web.py +++ b/tools/web.py @@ -114,7 +114,7 @@ def getURLContent(url, timeout=15): if res.status == http.client.OK or res.status == http.client.SEE_OTHER: return data.decode(charset) - elif res.status == http.client.FOUND or res.status == http.client.MOVED_PERMANENTLY: + elif (res.status == http.client.FOUND or res.status == http.client.MOVED_PERMANENTLY) and res.getheader("Location") != url: return getURLContent(res.getheader("Location"), timeout) else: return None