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

Senthil report at bugs.python.org
Fri Jan 2 06:29:48 CET 2009


Senthil <orsenthil at gmail.com> added the comment:

> I am a little confused by this though. It looks like
> FileHandler.file_open() checks if there is a hostname in the URL, and
> if so, uses FTPHandler instead. So why does FileHandler.open_local_file
> check the hostname value?

You are right. Even I had observed this, but did not dispute it. Let
me try to look into the history to see why it so. Perhaps it needs to
change.

> For your other points, gethostbyname() in libc can only handle IPv4
> addresses. The IETF defined the getaddrinfo() interface as an IP
> version neutral replacement. I would recommend using getaddrinfo().
> Yes, FTPHandler creates an urllib.FTPWrapper object. That object calls
> into ftplib, which is already IPv6-capable. So, I don't think we need
> to do hostname resolution in FTPHandler.

Thanks for the info. I shall look into both in revision of the path.
1) using getaddrinfo() for IP version neutral call.
2) passing the hostname directly to ftplib. ( I am not sure of
consequences, need to investigate).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1675455>
_______________________________________


More information about the Python-bugs-list mailing list