Skip to content

Commit

Permalink
Improve performance of calling origin() for URLs with credentials (#1275
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bdraco authored Oct 15, 2024
1 parent 32a35be commit 5b3592a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ def _origin(self) -> "URL":
if "@" not in v.netloc:
val = v._replace(path="", query="", fragment="")
else:
encoded_host = self._encode_host(v.hostname) if v.hostname else ""
netloc = self._make_netloc(None, None, encoded_host, v.port)
encoded_host = self.host_subcomponent
netloc = self._make_netloc(None, None, encoded_host, self.explicit_port)
val = v._replace(netloc=netloc, path="", query="", fragment="")
return self._from_val(val)

Expand Down

0 comments on commit 5b3592a

Please sign in to comment.