Error out if a URL attempts to redirect to itself.
This commit is contained in:
parent
1509f895f1
commit
72754114f4
5
av98.py
5
av98.py
|
@ -416,7 +416,10 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
||||||
# Redirects
|
# Redirects
|
||||||
elif status.startswith("3"):
|
elif status.startswith("3"):
|
||||||
new_gi = GeminiItem(gi.absolutise_url(meta))
|
new_gi = GeminiItem(gi.absolutise_url(meta))
|
||||||
if new_gi.url in self.previous_redirectors:
|
if new_gi.url == gi.url:
|
||||||
|
print("Error: URL redirects to itself!")
|
||||||
|
return
|
||||||
|
elif new_gi.url in self.previous_redirectors:
|
||||||
print("Error: caught in redirect loop!")
|
print("Error: caught in redirect loop!")
|
||||||
return
|
return
|
||||||
elif len(self.previous_redirectors) == _MAX_REDIRECTS:
|
elif len(self.previous_redirectors) == _MAX_REDIRECTS:
|
||||||
|
|
Loading…
Reference in New Issue