Skip to content

Commit

Permalink
Fix: user/password replacement is not allowed for relative urls (#349)
Browse files Browse the repository at this point in the history
fix error `user/password replacement is not allowed for relative URLs` when using the parameter base_url of ClientSession constructor to send aiohttp requests
  • Loading branch information
tsonglew authored Jul 21, 2024
1 parent 28602ae commit 9c79cc6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion skywalking/plugins/sw_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def install():
_request = ClientSession._request

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

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

0 comments on commit 9c79cc6

Please sign in to comment.