Don't follow cross-domain redirects automatically.

This commit is contained in:
Solderpunk 2020-05-23 12:53:20 +02:00
parent 7a3f1c77a5
commit 8945fa4f7e
1 changed files with 5 additions and 0 deletions

View File

@ -413,6 +413,11 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
print("Error: caught in redirect loop!")
elif len(self.previous_redirectors) == _MAX_REDIRECTS:
print("Error: refusing to follow more than %d consecutive redirects!" % _MAX_REDIRECTS)
# Never follow cross-domain redirects without asking
elif new_gi.host != gi.host:
follow = input("Follow cross-domain redirect to %s? (y/n) " % new_gi.url)
if follow.strip().lower() not in ("y", "yes"):
return
elif not self.options["auto_follow_redirects"]:
follow = input("Follow redirect to %s? (y/n) " % new_gi.url)
if follow.strip().lower() not in ("y", "yes"):