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