Zachary Ware added the comment:

That looks like a bug in urllib3 to me.  The host is *not* 
'[2620:125:9014:3240:14:240:128:0]', the host is 
'2620:125:9014:3240:14:240:128:0'; the brackets are merely for disambiguating 
the port.

Compare to urllib.parse.urlsplit:

>>> from urllib.parse import urlsplit
>>> s = urlsplit('http://[2620:125:9014:3240:14:240:128:0]:8080/api/python')
>>> s.hostname
'2620:125:9014:3240:14:240:128:0'
>>> s.port
8080
>>> s.netloc
'[2620:125:9014:3240:14:240:128:0]:8080'

I'd recommend pursuing this with urllib3, but do take a look at existing IPv6 
parsing issues there as a cursory glance at their bug tracker shows several of 
them.

That said, I don't know of any particular reason not to strip brackets in 
HTTPConnection anyway.  Brackets cannot be part of a valid hostname, can they?

----------
nosy: +zach.ware

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28539>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to