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

Function user_domain_match

Lib/http/cookiejar.py:600–618  ·  view source on GitHub ↗

For blocking/accepting domains. A and B may be host domain names or IP addresses.

(A, B)

Source from the content-addressed store, hash-verified

598 return True
599
600def user_domain_match(A, B):
601 """For blocking/accepting domains.
602
603 A and B may be host domain names or IP addresses.
604
605 """
606 A = A.lower()
607 B = B.lower()
608 if not (liberal_is_HDN(A) and liberal_is_HDN(B)):
609 if A == B:
610 # equal IP addresses
611 return True
612 return False
613 initial_dot = B.startswith(".")
614 if initial_dot and A.endswith(B):
615 return True
616 if not initial_dot and A == B:
617 return True
618 return False
619
620cut_port_re = re.compile(r":\d+$", re.ASCII)
621def request_host(request):

Callers 3

test_domain_matchMethod · 0.90
is_blockedMethod · 0.85
is_not_allowedMethod · 0.85

Calls 4

liberal_is_HDNFunction · 0.85
lowerMethod · 0.45
startswithMethod · 0.45
endswithMethod · 0.45

Tested by 1

test_domain_matchMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…