(self, host, port)
| 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 |
no test coverage detected