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

Function request_host

Lib/http/cookiejar.py:621–635  ·  view source on GitHub ↗

Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison.

(request)

Source from the content-addressed store, hash-verified

619
620cut_port_re = re.compile(r":\d+$", re.ASCII)
621def request_host(request):
622 """Return request-host, as defined by RFC 2965.
623
624 Variation from RFC: returned value is lowercased, for convenient
625 comparison.
626
627 """
628 url = request.get_full_url()
629 host = urllib.parse.urlparse(url)[1]
630 if host == "":
631 host = request.get_header("Host", "")
632
633 # remove port, if present
634 host = cut_port_re.sub("", host, 1)
635 return host.lower()
636
637def eff_request_host(request):
638 """Return a tuple (request-host, effective request-host name).

Callers 3

test_request_hostMethod · 0.90
eff_request_hostFunction · 0.70
is_third_partyFunction · 0.70

Calls 4

get_full_urlMethod · 0.80
get_headerMethod · 0.45
subMethod · 0.45
lowerMethod · 0.45

Tested by 1

test_request_hostMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…