browser: make max redirection value a class var

This commit is contained in:
dece 2021-11-15 09:51:33 +01:00
parent f48a8ab606
commit ef6b8929e3

View file

@ -69,6 +69,7 @@ class Browser:
SEARCH_NEXT = 0
SEARCH_PREVIOUS = 1
MAX_REDIRECTIONS = 5
def __init__(self, config, cert_stash):
self.config = config
@ -420,7 +421,7 @@ class Browser:
- history: whether the URL should be pushed to history on success.
- use_cache: whether we should look for an already cached document.
"""
if redirects > 5:
if redirects > self.MAX_REDIRECTIONS:
self.set_status_error(f"Too many redirections ({url}).")
return