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

Method _get_hostport

Lib/http/client.py:950–968  ·  view source on GitHub ↗
(self, host, port)

Source from the content-addressed store, hash-verified

948 encoded_host, self._tunnel_port)
949
950 def _get_hostport(self, host, port):
951 if port is None:
952 i = host.rfind(':')
953 j = host.rfind(']') # ipv6 addresses have [...]
954 if i > j:
955 try:
956 port = int(host[i+1:])
957 except ValueError:
958 if host[i+1:] == "": # http://foo.com:/ == http://foo.com/
959 port = self.default_port
960 else:
961 raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
962 host = host[:i]
963 else:
964 port = self.default_port
965 if host and host[0] == '[' and host[-1] == ']':
966 host = host[1:-1]
967
968 return (host, port)
969
970 def set_debuglevel(self, level):
971 self.debuglevel = level

Callers 2

__init__Method · 0.95
set_tunnelMethod · 0.95

Calls 2

InvalidURLClass · 0.85
rfindMethod · 0.45

Tested by

no test coverage detected