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

Function reach

Lib/http/cookiejar.py:692–725  ·  view source on GitHub ↗

Return reach of host h, as defined by RFC 2965, section 1. The reach R of a host name H is defined as follows: * If - H is the host domain name of a host; and, - H has the form A.B; and - A has no embedded (that is, interior) dots; and -

(h)

Source from the content-addressed store, hash-verified

690 return path
691
692def reach(h):
693 """Return reach of host h, as defined by RFC 2965, section 1.
694
695 The reach R of a host name H is defined as follows:
696
697 * If
698
699 - H is the host domain name of a host; and,
700
701 - H has the form A.B; and
702
703 - A has no embedded (that is, interior) dots; and
704
705 - B has at least one embedded dot, or B is the string "local".
706 then the reach of H is .B.
707
708 * Otherwise, the reach of H is H.
709
710 >>> reach("www.acme.com")
711 '.acme.com'
712 >>> reach("acme.com")
713 'acme.com'
714 >>> reach("acme.local")
715 '.local'
716
717 """
718 i = h.find(".")
719 if i >= 0:
720 #a = h[:i] # this line is only here to show what a is
721 b = h[i+1:]
722 i = b.find(".")
723 if is_HDN(h) and (i >= 0 or b == "local"):
724 return "."+b
725 return h
726
727def is_third_party(request):
728 """

Callers 2

test_reachMethod · 0.90
is_third_partyFunction · 0.85

Calls 2

is_HDNFunction · 0.85
findMethod · 0.45

Tested by 1

test_reachMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…