From cce2e330ba5f094a4d519cc302ceacac7739a93d Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Fri, 29 Oct 2021 20:06:30 +0200 Subject: [PATCH] Timeout richieste 5 secondi di default, 2 per i DNS --- core/httptools.py | 2 +- lib/doh.py | 2 +- resources/settings.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/httptools.py b/core/httptools.py index 7727800f..73293d29 100755 --- a/core/httptools.py +++ b/core/httptools.py @@ -52,7 +52,7 @@ directIP = { } # Maximum wait time for downloadpage, if nothing is specified -HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.get_setting('httptools_timeout', default=15) +HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.get_setting('httptools_timeout', default=5) if HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT == 0: HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = None # Random use of User-Agents, if nad is not specified diff --git a/lib/doh.py b/lib/doh.py index 14ce62a6..feb5e3aa 100644 --- a/lib/doh.py +++ b/lib/doh.py @@ -38,7 +38,7 @@ def query(name, type='A', server=DOH_SERVER, path="/dns-query", fallback=True): try: req = _Request("https://%s%s?name=%s&type=%s" % (server, path, name, type), headers={"Accept": "application/dns-json"}) - content = _urlopen(req).read().decode() + content = _urlopen(req, timeout=2).read().decode() reply = json.loads(content) if "Answer" in reply: diff --git a/resources/settings.xml b/resources/settings.xml index 95a28b0a..6152bcec 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -66,7 +66,7 @@ - +