Skip to content

Commit

Permalink
Avoid splitting the netloc for simple cases when constructing URL (#1277
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bdraco authored Oct 15, 2024
1 parent 21b38a2 commit a9ba9bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ def __new__(
if not netloc: # netloc
host = ""
else:
username, password, host, port = cls._split_netloc(netloc)
if ":" in netloc or "@" in netloc or "[" in netloc:
# Complex netloc
username, password, host, port = cls._split_netloc(netloc)
else:
username = password = port = None
host = netloc
if host is None:
if scheme in SCHEME_REQUIRES_HOST:
msg = (
Expand Down

0 comments on commit a9ba9bb

Please sign in to comment.