Skip to content

Commit

Permalink
fix proxy problem
Browse files Browse the repository at this point in the history
  • Loading branch information
zrquan committed Nov 13, 2024
1 parent f1a1d30 commit 27206b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/connection/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ async def replay_request(self, path: str, proxy: str) -> AsyncResponse:
mounts={"all://": transport},
timeout=httpx.Timeout(options["timeout"]),
)
return await self.request(path, self.replay_session)
return await self.request(path, self.replay_session, replay=True)

# :path: is expected not to start with "/"
async def request(
self, path: str, session: httpx.AsyncClient | None = None
self, path: str, session: httpx.AsyncClient | None = None, replay: bool = False
) -> AsyncResponse:
while self.is_rate_exceeded():
await asyncio.sleep(0.1)
Expand All @@ -374,7 +374,6 @@ async def request(

# Safe quote all special characters to prevent them from being encoded
url = safequote(self._url + path if self._url else path)
parsed_url = urlparse(url)

session = session or self.session
for _ in range(options["max_retries"] + 1):
Expand All @@ -389,7 +388,9 @@ async def request(
headers=self.headers,
data=options["data"],
)
if p := parsed_url.path:
if replay:
request.extensions = {"target": url.encode()}
elif p := urlparse(url).path:
request.extensions = {"target": p.encode()}

xresponse = await session.send(
Expand Down

0 comments on commit 27206b8

Please sign in to comment.