missed the obvious test case and corresponding fix
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 2f117d8..b7276af 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -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:
                 try:
                     port = int(host[i+1:])
                 except ValueError: