mirror of
https://github.com/searxng/searxng
synced 2024-11-05 06:01:05 +00:00
[mod] /image_proxy: don't decompress images
This commit is contained in:
parent
dec9df28f3
commit
df15c655f7
@ -165,7 +165,9 @@ async def stream_chunk_to_queue(network, queue, method, url, **kwargs):
|
|||||||
try:
|
try:
|
||||||
async with network.stream(method, url, **kwargs) as response:
|
async with network.stream(method, url, **kwargs) as response:
|
||||||
queue.put(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:
|
if len(chunk) > 0:
|
||||||
queue.put(chunk)
|
queue.put(chunk)
|
||||||
except (httpx.HTTPError, OSError, h2.exceptions.ProtocolError) as e:
|
except (httpx.HTTPError, OSError, h2.exceptions.ProtocolError) as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user