MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / request_host

Function request_host

tools/python-3.11.9-amd64/Lib/urllib/request.py:301–315  ·  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

299# copied from cookielib.py
300_cut_port_re = re.compile(r":\d+$", re.ASCII)
301def request_host(request):
302 """Return request-host, as defined by RFC 2965.
303
304 Variation from RFC: returned value is lowercased, for convenient
305 comparison.
306
307 """
308 url = request.full_url
309 host = urlparse(url)[1]
310 if host == "":
311 host = request.get_header("Host", "")
312
313 # remove port, if present
314 host = _cut_port_re.sub("", host, 1)
315 return host.lower()
316
317class Request:
318

Callers 1

__init__Method · 0.70

Calls 4

urlparseFunction · 0.90
get_headerMethod · 0.45
subMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected