MCPcopy Index your code
hub / github.com/python/cpython / is_HDN

Function is_HDN

Lib/http/cookiejar.py:536–549  ·  view source on GitHub ↗

Return True if text is a host domain name.

(text)

Source from the content-addressed store, hash-verified

534
535IPV4_RE = re.compile(r"\.\d+$", re.ASCII)
536def is_HDN(text):
537 """Return True if text is a host domain name."""
538 # XXX
539 # This may well be wrong. Which RFC is HDN defined in, if any (for
540 # the purposes of RFC 2965)?
541 # For the current implementation, what about IPv6? Remember to look
542 # at other uses of IPV4_RE also, if change this.
543 if IPV4_RE.search(text):
544 return False
545 if text == "":
546 return False
547 if text[0] == "." or text[-1] == ".":
548 return False
549 return True
550
551def domain_match(A, B):
552 """Return True if domain A domain-matches domain B, according to RFC 2965.

Callers 3

test_is_HDNMethod · 0.90
domain_matchFunction · 0.85
reachFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by 1

test_is_HDNMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…