File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -536,7 +536,15 @@ def parse_ns_headers(ns_headers):
536536IPV4_RE = re .compile (r"\.\d+$" , re .ASCII )
537537
538538def is_ip_like_hostname (text ):
539- """Return True if text is a valid hostname in the form of IP address."""
539+ """Return True if text is a valid hostname in the form of IP address.
540+
541+ If text is a valid IPv4 address, retrun True;
542+
543+ If text is a valid IPv6 address wrapped in [], return True;
544+
545+ Else, return False
546+
547+ """
540548 from ipaddress import IPv4Address , IPv6Address
541549 # check for IPv4 address
542550 try :
@@ -667,6 +675,8 @@ def eff_request_host(request):
667675 is_ipV6 = False
668676 if "." not in req_host and not is_ipV6 :
669677 # avoid adding .local at the end of a IPV6 address
678+ # for the additional ".local", see RFC 2965 section 1
679+ # https://www.rfc-editor.org/rfc/rfc2965
670680 erhn = req_host + ".local"
671681 return req_host , erhn
672682
You can’t perform that action at this time.
0 commit comments