[issue1675455] Use getaddrinfo() in urllib2.py for IPv6 support

Senthil report at bugs.python.org
Tue Sep 25 05:37:43 CEST 2007


Senthil added the comment:

Hi,
The patch attached required a complete rewrite. I am attaching the
modified patch, which will just substitute socket.gethostbyname with a
function gethost_addrinfo which internally uses getaddrinfo and takes
care of the IPv4 or IPv6 addresses translation.

jjlee, skip: let me know your comments on this.

One note we have to keep in mind is, testing on IPv6 address.
For eg. on my system /etc/hosts
10.98.1.6       goofy.goofy.com
#fe80::219:5bff:fefd:6270       localhost
127.0.0.1       localhost

test_urllib2 will PASS for the above.
But if I uncomment the IPv6 address, opening the local file fails. I am
not sure how local file access is done with IPv6 and should urllib2
(local file opening function) itself needs to be modified. Shall check
into that, with next version.

----------
nosy: +orsenthil

_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1675455>
_____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: urllib2-getaddrinfo.patch
Type: text/x-diff
Size: 2457 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-bugs-list/attachments/20070925/be83570f/attachment.patch 


More information about the Python-bugs-list mailing list