Author cfs-pure
Recipients cfs-pure, martin.panter
Date 2016-10-26.22:03:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477519438.16.0.254960167532.issue28539@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-10-26 22:03:58cfs-puresetrecipients: + cfs-pure, martin.panter
2016-10-26 22:03:58cfs-puresetmessageid: <1477519438.16.0.254960167532.issue28539@psf.upfronthosting.co.za>
2016-10-26 22:03:58cfs-purelinkissue28539 messages
2016-10-26 22:03:57cfs-purecreate