summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-08-16 10:11:45 +0200
committerAlexandre Flament <alex@al-f.net>2021-08-24 14:51:20 +0200
commitdf15c655f765798ee88a788df7be109d6a1bfcb2 (patch)
tree4a96152f8e24f44fb3b89a509c6002dacc69a5f9 /searx
parentdec9df28f3e37c5793e53898dd63419660230b4e (diff)
downloadsearxng-df15c655f765798ee88a788df7be109d6a1bfcb2.tar.gz
searxng-df15c655f765798ee88a788df7be109d6a1bfcb2.zip
[mod] /image_proxy: don't decompress images
Diffstat (limited to 'searx')
-rw-r--r--searx/network/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/network/__init__.py b/searx/network/__init__.py
index c921bdecb..aaebb7928 100644
--- a/searx/network/__init__.py
+++ b/searx/network/__init__.py
@@ -165,7 +165,9 @@ async def stream_chunk_to_queue(network, queue, method, url, **kwargs):
try:
async with network.stream(method, url, **kwargs) as response:
queue.put(response)
- async for chunk in response.aiter_bytes(65536):
+ # aiter_raw: access the raw bytes on the response without applying any HTTP content decoding
+ # https://www.python-httpx.org/quickstart/#streaming-responses
+ async for chunk in response.aiter_raw(65536):
if len(chunk) > 0:
queue.put(chunk)
except (httpx.HTTPError, OSError, h2.exceptions.ProtocolError) as e: