Backport proxify to older python version

This commit is contained in:
John Xina 2024-02-19 22:18:00 +08:00
parent d63dc1bad4
commit f2d6ec3169

View File

@ -99,13 +99,12 @@ class Asgiproxify():
})
async for chunk, _ in resp.content.iter_chunks():
try:
async with asyncio.timeout(10):
await send({
'type': 'http.response.body',
'body': chunk,
'more_body': True,
})
except TimeoutError:
await asyncio.wait_for(send({
'type': 'http.response.body',
'body': chunk,
'more_body': True,
}), timeout=10)
except asyncio.TimeoutError:
return
await send({'type': 'http.response.body'})