Skip to content

Commit 382ddd7

Browse files
csreddy98orsenthil
authored andcommitted
gh-105708: 'V' could be case insensitive for IPvFuture hostnames & checking empty hostnames
1 parent e486f93 commit 382ddd7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/urllib/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def _check_bracketed_netloc(netloc):
544544
# Valid bracketed hosts are defined in
545545
# https://www.rfc-editor.org/rfc/rfc3986#page-49 and https://url.spec.whatwg.org/
546546
def _check_bracketed_host(hostname):
547-
if hostname[0].lower() == 'v':
547+
if len(hostname) > 0 and hostname[0].lower() == 'v':
548548
if not re.match(r"\A[vV][a-fA-F0-9]+\..+\Z", hostname):
549549
raise ValueError(f"IPvFuture address is invalid")
550550
else:

0 commit comments

Comments
 (0)