Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogTheFrog committed Aug 3, 2024
1 parent 9e3596c commit cb07455
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions backend/decky_loader/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,17 @@ async def http_request(self, req: Request) -> StreamResponse:
# the Content-Encoding header in the response headers, however that would
# defeat the point of this proxy.
async with ClientSession(auto_decompress=False) as web:
self.logger.debug(f"Starting request for {url}")
async with web.request(req.method, url, headers=headers, data=body, ssl=helpers.get_ssl_context()) as web_res:
res = StreamResponse(headers=web_res.headers, status=web_res.status)
if web_res.headers.get('Transfer-Encoding', '').lower() == 'chunked':
res.enable_chunked_encoding()

await res.prepare(req)
await res.write(await web_res.read())
self.logger.debug(f"Finished request for {url}")
self.logger.debug(f"Starting stream for {url}")
async for data in web_res.content.iter_any():
await res.write(data)

self.logger.debug(f"Finished stream for {url}")
return res

async def http_request_legacy(self, method: str, url: str, extra_opts: Any = {}):
Expand Down

0 comments on commit cb07455

Please sign in to comment.