mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-21 08:06:30 +00:00
Stream requests to ingress (#2979)
* Chunk large requests to ingress * Remove timout for POST * No timeout * stream * Remove chunked
This commit is contained in:
parent
564e9811d0
commit
8a9657c452
@ -5,7 +5,7 @@ import logging
|
|||||||
from typing import Any, Dict, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiohttp import hdrs, web
|
from aiohttp import ClientTimeout, hdrs, web
|
||||||
from aiohttp.web_exceptions import (
|
from aiohttp.web_exceptions import (
|
||||||
HTTPBadGateway,
|
HTTPBadGateway,
|
||||||
HTTPServiceUnavailable,
|
HTTPServiceUnavailable,
|
||||||
@ -162,7 +162,6 @@ class APIIngress(CoreSysAttributes):
|
|||||||
) -> Union[web.Response, web.StreamResponse]:
|
) -> Union[web.Response, web.StreamResponse]:
|
||||||
"""Ingress route for request."""
|
"""Ingress route for request."""
|
||||||
url = self._create_url(addon, path)
|
url = self._create_url(addon, path)
|
||||||
data = await request.read()
|
|
||||||
source_header = _init_header(request, addon)
|
source_header = _init_header(request, addon)
|
||||||
|
|
||||||
async with self.sys_websession.request(
|
async with self.sys_websession.request(
|
||||||
@ -171,7 +170,8 @@ class APIIngress(CoreSysAttributes):
|
|||||||
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)
|
||||||
|
|
||||||
@ -219,6 +219,7 @@ def _init_header(
|
|||||||
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