From 8cd2cb7381c779213d7e59c682386afb8ac75dd5 Mon Sep 17 00:00:00 2001 From: 4shen0ne <4shen.01@gmail.com> Date: Thu, 24 Oct 2024 14:11:24 +0800 Subject: [PATCH] forward proxy requests using an absolute URI --- lib/connection/requester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/connection/requester.py b/lib/connection/requester.py index b7c34c6c2..c67428346 100755 --- a/lib/connection/requester.py +++ b/lib/connection/requester.py @@ -284,6 +284,7 @@ def __init__(self, proxies: list[str], **kwargs: Any) -> None: ] async def handle_async_request(self, request: httpx.Request) -> httpx.Response: + request.extensions["target"] = str(request.url).encode() transport = random.choice(self._transports) return await transport.handle_async_request(request) @@ -300,7 +301,7 @@ def __init__(self) -> None: } transport = ( ProxyRoatingTransport( - list(map(self.parse_proxy, options["proxies"])), **tpargs + [self.parse_proxy(p) for p in options["proxies"]], **tpargs ) if options["proxies"] else httpx.AsyncHTTPTransport(**tpargs)