Charles Stephens added the comment:
I misapplied the term 'regression'. My intent was to describe how original
author's change revision 433606e9546c was refactored to make it perform
incorrectly.
Without the scope specifier, the outcome is the same when HTTPConnection is
instantiated. When both the host and port arguments are specified, the square
brackets are not stripped and are stored in the host attribute. When the port
number is part of the host argument and the port argument is None, the host
attribute does not include the square brackets. Examples:
Python 2.7.10 (default, Jul 30 2016, 18:31:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib
>>> con1 = httplib.HTTPConnection('[fe80::26a9:37ff:fe00:f764]', 15482)
>>> con1.host, con1.port
('[fe80::26a9:37ff:fe00:f764]', 15482)
>>> con2 = httplib.HTTPConnection('[fe80::26a9:37ff:fe00:f764]:15482')
>>> con2.host, con2.port
('fe80::26a9:37ff:fe00:f764', 15482)
Compare with IPv4 behavior:
>>> con3 = httplib.HTTPConnection('127.0.0.1', 15482)
>>> con3.host, con3.port
('127.0.0.1', 15482)
>>> con4 = httplib.HTTPConnection('127.0.0.1:15482')
>>> con4.host, con4.port
('127.0.0.1', 15482)
Calls to con1.request() will fail in socket.py because getaddrinfo will choke
on the square brackets. Which makes sense since HTTPConnection.host is passed
on down the stack as-is until it reaches create_connection() in socket.py.
Moving the indent of that if block up one level makes con1 identical to con2.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28539>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com