summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-08-14 20:12:11 +0200
committerAlexandre Flament <alex@al-f.net>2021-08-24 14:51:20 +0200
commit3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb (patch)
treefbdb0734a49fcd32ba97e816a1ceab86d5e5c462 /searx/webapp.py
parent43fcaa642a63d75096b33d44ce7f7c0de1bce614 (diff)
downloadsearxng-3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb.tar.gz
searxng-3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb.zip
[mod] /image_proxy: use HTTP/1 instead of HTTP/2
httpx: HTTP/2 is slow when a lot data is downloaded. https://github.com/dalf/pyhttp-benchmark also, the usage of HTTP/1 decreases the load average
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 0b60969a8..3b7e0f972 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -108,7 +108,7 @@ from searx.autocomplete import search_autocomplete, backends as autocomplete_bac
from searx.languages import language_codes as languages
from searx.locales import LOCALE_NAMES, UI_LOCALE_CODES, RTL_LOCALES
from searx.search import SearchWithPlugins, initialize as search_initialize
-from searx.network import stream as http_stream
+from searx.network import stream as http_stream, set_context_network_name
from searx.search.checker import get_result as checker_get_result
from searx.settings_loader import get_default_settings_path
@@ -1086,13 +1086,11 @@ def image_proxy():
'Sec-GPC': '1',
'DNT': '1',
}
+ set_context_network_name('image_proxy')
stream = http_stream(
method = 'GET',
url = url,
- headers = request_headers,
- timeout = settings['outgoing']['request_timeout'],
- allow_redirects = True,
- max_redirects = 20
+ headers = request_headers
)
resp = next(stream)
content_length = resp.headers.get('Content-Length')