mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Stream requests to ingress (#52184)
This commit is contained in:
parent
dad7a597ae
commit
328ab21a05
@ -7,7 +7,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiohttp import hdrs, web
|
from aiohttp import ClientTimeout, hdrs, web
|
||||||
from aiohttp.web_exceptions import HTTPBadGateway
|
from aiohttp.web_exceptions import HTTPBadGateway
|
||||||
from multidict import CIMultiDict
|
from multidict import CIMultiDict
|
||||||
|
|
||||||
@ -117,7 +117,6 @@ class HassIOIngress(HomeAssistantView):
|
|||||||
) -> web.Response | web.StreamResponse:
|
) -> web.Response | web.StreamResponse:
|
||||||
"""Ingress route for request."""
|
"""Ingress route for request."""
|
||||||
url = self._create_url(token, path)
|
url = self._create_url(token, path)
|
||||||
data = await request.read()
|
|
||||||
source_header = _init_header(request, token)
|
source_header = _init_header(request, token)
|
||||||
|
|
||||||
async with self._websession.request(
|
async with self._websession.request(
|
||||||
@ -126,7 +125,8 @@ class HassIOIngress(HomeAssistantView):
|
|||||||
headers=source_header,
|
headers=source_header,
|
||||||
params=request.query,
|
params=request.query,
|
||||||
allow_redirects=False,
|
allow_redirects=False,
|
||||||
data=data,
|
data=request.content,
|
||||||
|
timeout=ClientTimeout(total=None),
|
||||||
) as result:
|
) as result:
|
||||||
headers = _response_header(result)
|
headers = _response_header(result)
|
||||||
|
|
||||||
@ -168,6 +168,7 @@ def _init_header(request: web.Request, token: str) -> CIMultiDict | dict[str, st
|
|||||||
if name in (
|
if name in (
|
||||||
hdrs.CONTENT_LENGTH,
|
hdrs.CONTENT_LENGTH,
|
||||||
hdrs.CONTENT_ENCODING,
|
hdrs.CONTENT_ENCODING,
|
||||||
|
hdrs.TRANSFER_ENCODING,
|
||||||
hdrs.SEC_WEBSOCKET_EXTENSIONS,
|
hdrs.SEC_WEBSOCKET_EXTENSIONS,
|
||||||
hdrs.SEC_WEBSOCKET_PROTOCOL,
|
hdrs.SEC_WEBSOCKET_PROTOCOL,
|
||||||
hdrs.SEC_WEBSOCKET_VERSION,
|
hdrs.SEC_WEBSOCKET_VERSION,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user