tools.web: Avoid explicit redirection loop
This commit is contained in:
parent
6976846e23
commit
d575c0d6d3
@ -114,7 +114,7 @@ def getURLContent(url, timeout=15):
|
|||||||
|
|
||||||
if res.status == http.client.OK or res.status == http.client.SEE_OTHER:
|
if res.status == http.client.OK or res.status == http.client.SEE_OTHER:
|
||||||
return data.decode(charset)
|
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)
|
return getURLContent(res.getheader("Location"), timeout)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user