Martin v. Löwis added the comment:

I was about to say that I agree that AI_ADDRCONFIG should be used in 
create_connection. However, RFC 3493 deviates from RFC 2553 by stating

"""If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
   returned only if an IPv4 address is configured on the local system,
   and IPv6 addresses shall be returned only if an IPv6 address is
   configured on the local system.  The loopback address is not
   considered for this case as valid as a configured address.
"""

If this is taken literally, then it would not be possible to connect anymore to 
localhost if you have no IP address configured except for the loopback 
addresses - which in turn would make the test fail also (and would clearly be 
undesirable).

OSX clearly ignores that RFC - even with no IPv4 address configured, I get a 
result that includes 127.0.0.1. I wonder how other systems respond to 

socket.getaddrinfo('localhost', 80, 0, socket.SOCK_STREAM, 0, 
socket.AI_ADDRCONFIG)

if all interfaces except for lo are down (remember to reactivate the interfaces 
before posting a response to the bug tracker :-)

Any patch needs to be careful to use the flag only if available. Microsoft 
points out that the flag works only on Vista+. Not sure whether it just has no 
effect on XP, or makes the call fail.

----------
nosy: +loewis

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

Reply via email to