Close stream request once we end up with proxy (#9110)

* Close stream request once we end up with proxy

* Update aiohttp_client.py

* Update aiohttp_client.py

* Removed trailing whitespace
This commit is contained in:
Andrey Kupreychik 2017-08-26 23:56:39 +07:00 committed by Paulus Schoutsen
parent 493353e4de
commit c537770786

View File

@ -90,8 +90,15 @@ def async_aiohttp_proxy_web(hass, request, web_coro, buffer_size=102400,
# Something went wrong with the connection
raise HTTPBadGateway() from err
yield from async_aiohttp_proxy_stream(hass, request, req.content,
req.headers.get(CONTENT_TYPE))
try:
yield from async_aiohttp_proxy_stream(
hass,
request,
req.content,
req.headers.get(CONTENT_TYPE)
)
finally:
req.close()
@asyncio.coroutine