Skip to content

Commit

Permalink
Update utilities.py
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogTheFrog authored Jul 30, 2024
1 parent 75eb940 commit 53d4965
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions backend/decky_loader/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,12 @@ async def http_request(self, req: Request) -> StreamResponse:
if req.headers.get('X-Decky-Auth', '') != helpers.get_csrf_token() and req.query.get('auth', '') != helpers.get_csrf_token():
return Response(text='Forbidden', status=403)

req_from_fetch = "X-Decky-Fetch-URL" in req.headers
url = req.headers["X-Decky-Fetch-URL"] if req_from_fetch else unquote(req.query.get('fetch_url', ''))
url = req.headers["X-Decky-Fetch-URL"] if "X-Decky-Fetch-URL" in req.headers else unquote(req.query.get('fetch_url', ''))
self.logger.info(f"Preparing {req.method} request to {url}")

headers = dict(req.headers)

if not req_from_fetch:
headers["User-Agent"] = helpers.user_agent
headers["User-Agent"] = helpers.user_agent

for excluded_header in excluded_default_headers:
self.logger.debug(f"Excluding default header {excluded_header}")
Expand Down Expand Up @@ -195,7 +193,6 @@ async def http_request(self, req: Request) -> StreamResponse:
if data:
await res.drain()
self.logger.debug(f"Finished stream for {url}")
self.logger.debug(f"Response headers: {res.headers}")
return res

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

0 comments on commit 53d4965

Please sign in to comment.