Skip to content

Commit 9c79cc6

Browse files
authored
Fix: user/password replacement is not allowed for relative urls (#349)
fix error `user/password replacement is not allowed for relative URLs` when using the parameter base_url of ClientSession constructor to send aiohttp requests
1 parent 28602ae commit 9c79cc6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

skywalking/plugins/sw_aiohttp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def install():
4040
_request = ClientSession._request
4141

4242
async def _sw_request(self: ClientSession, method: str, str_or_url, **kwargs):
43-
url = URL(str_or_url).with_user(None).with_password(None)
43+
abs_url = self._build_url(str_or_url) if hasattr(self, '_build_url') else URL(str_or_url)
44+
url = abs_url.with_user(None).with_password(None)
4445
peer = f"{url.host or ''}:{url.port or ''}"
4546

4647
if config.agent_protocol == 'http' and config.agent_collector_backend_services.rstrip('/') \

0 commit comments

Comments
 (0)