Skip to content

Commit cc97b8e

Browse files
committed
Work on
1 parent 47072ca commit cc97b8e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

aiohttp/client.py

+4
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ def _request(self, method, url, *,
331331
elif not scheme:
332332
r_url = url.join(r_url)
333333

334+
if url.origin() != r_url.origin():
335+
auth = None
336+
headers.pop(hdrs.AUTHORIZATION)
337+
334338
url = r_url
335339
params = None
336340
resp.release()

aiohttp/client_reqrep.py

+7
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ def update_host(self, url):
154154
if not url.host:
155155
raise InvalidURL(url)
156156

157+
# basic auth info
158+
username, password = url.user, url.password
159+
if username:
160+
self.auth = helpers.BasicAuth(username, password or '')
161+
162+
# Record entire netloc for usage in host header
163+
157164
scheme = url.scheme
158165
self.ssl = scheme in ('https', 'wss')
159166

0 commit comments

Comments
 (0)