Skip to content

Commit

Permalink
[PR #9372/0416d28 backport][3.10] Only prepare proxy headers for a re…
Browse files Browse the repository at this point in the history
…quest if a proxy is set (#9376)
  • Loading branch information
bdraco authored Oct 1, 2024
1 parent 0a74b54 commit 57ce46c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ async def _request(

# Merge with default headers and transform to CIMultiDict
headers = self._prepare_headers(headers)
proxy_headers = self._prepare_headers(proxy_headers)

try:
url = self._build_url(str_or_url)
Expand All @@ -526,7 +525,10 @@ async def _request(
for i in skip_auto_headers:
skip_headers.add(istr(i))

if proxy is not None:
if proxy is None:
proxy_headers = None
else:
proxy_headers = self._prepare_headers(proxy_headers)
try:
proxy = URL(proxy)
except ValueError as e:
Expand Down

0 comments on commit 57ce46c

Please sign in to comment.