We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af9d29e commit 56ac545Copy full SHA for 56ac545
Lib/http/cookiejar.py
@@ -648,7 +648,15 @@ def eff_request_host(request):
648
649
"""
650
erhn = req_host = request_host(request)
651
- is_IPV6 = req_host.startswith('[') and req_host.endswith(']')
+ if req_host.startswith('[') and req_host.endswith(']'):
652
+ from ipaddress import IPv6Address
653
+ try:
654
+ IPv6Address(req_host.removeprefix('[').removesuffix(']'))
655
+ is_IPV6 = True
656
+ except ValueError:
657
+ is_IPV6 = False
658
+ else:
659
660
if "." not in req_host and not is_IPV6:
661
# avoid adding .local at the end of a IPV6 address
662
erhn = req_host + ".local"
0 commit comments