Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proxy problem #1438

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading