[Python-Dev] Re: python/dist/src/Lib httplib.py,1.88,1.89

Fredrik Lundh fredrik at pythonware.com
Sun Sep 26 14:06:30 CEST 2004


> +++ httplib.py	14 Sep 2004 17:55:21 -0000	1.89
> @@ -525,7 +525,8 @@
>      def _set_hostport(self, host, port):
>          if port is None:
>              i = host.rfind(':')
> -            if i >= 0:
> +            j = host.rfind(']')         # ipv6 addresses have [...]
> +            if i > j:

one-line alternative:

		i = host.find(":", host.rfind("]"))

</F>



More information about the Python-Dev mailing list