[Python-Dev] _socket efficiencies ideas
Wed, 9 Apr 2003 09:20:50 -0500
OK, I'll chime back in on the thread I started... I mostly have a
question for Sean, since he seems to know the networking stuff well.
Do you know of any reason why my original proposal (which is to allows
IP addresses prefixed with <numeric> e.g. <numeric>127.0.0.1 to cause
both the AI_PASSIVE _and_ AI_NUMERIC flags to get set when resolution
is attempted, which basically causes parsing with not real resolution
at all) would break any known or plausible networking standards? The
current Python socket module basically hides this part of the BSD
socket API, and I find it quite useful to be able to suppress DNS
activity absolutely for some addresses.
And for Guido: since this type of tag has already been used in Python
(as <broadcast>), is there any reason why this solution is inelegant?
On Wednesday, April 9, 2003, at 08:51 AM, Guido van Rossum wrote:
>> On Tue, Apr 08, 2003 at 10:50:50AM -0400, Guido van Rossum wrote:
>>> Are you sure that it tries make a DNS call even when the address is
>>> pure numeric? That seems a mistake, and if that's really happening,
>> My first thought is that there should be a local DNS cache on the
>> machine that is running these apps. My second thought is that Python
>> could benefit from caching some lookup information...
> I don't want to build a cache into Python, it should already be part
> of libresolv.
>>> address is purely numeric. I'd be happy to see a patch that
>>> intercepts addresses of the form \d+\.\d+\.\d+\.\d+ and parses those
>>> without calling getaddrinfo().
>> It's not quite that easy. Beyond the IPV6 issues mentioned elsewhere,
> The IPv6 folks can add their own cache.
>> you'd also want to check "\d+.\d+" and "\d+\.\d+\.\d+". IP addresses
>> will fill in missing ".0"s, which is particularly handy for accessing
>> "127.1", which gets expanded to "127.0.0.1".
> I didn't even know this, and I think it's bad style to use something
> that obscure (most people would probably guess that 127.1 means
> 0.0.127.1 or 127.1.0.0).
> But since you seem to know about this stuff, perhaps you can submit a
> --Guido van Rossum (home page: http://www.python.org/~guido/)