On Monday 02 March 2009 09:49:36 Steve wrote:
> Oh heck, this bug is in the underlying TCPClient!  After spending days
> developing against localhost, I now find that I can't go live without
> having to do manual name resolution.  :(

I've done some digging. There's definitely something odd going on here.

I got suspicious that there was a bug in TCPClient. Specifically, if you do:
TCPClient("www.google.com", 80)
This results in a call inside TCPClient of:

self.safeConnect(sock, ("www.google.com", 80))

Which results in (fundamentally) :
sock.connect(("www.google.com", 80))

This has worked (correctly) for the past several years, hence the surprise.

However, your comment made me wonder if this should result in on some 
platforms:

IP = sock.gethostbyname("www.google.com")
sock.connect((IP, 80))

Since that's what you'd normally do with the C sockets API.

However, re-reading both the docs for the socket module *AND* looking at the 
source for Python-2.6.1/Modules/socketmodule.c , I note that the comments in 
the socketmodule say:

/* Convert a string specifying a host name or one of a few symbolic
   names to a numeric IP address.  This usually calls gethostbyname()
   to do the work; the names "" and "<broadcast>" are special.
   Return the length (IPv4 should be 4 bytes), or negative if
   an error occurred; then an exception is raised. */

Specifically this means that socket.connect itself decodes (for example) the 
IP address "66.102.7.99" - for example from:
SingleShotHTTPClient('http://66.102.7.99:8000/') => OK

Using the same function, which through one path checks for something looking 
like an IP and parses it, and through the other path, ends up calling 
gethostbyname (in gettaddrinfo.c) UNLESS you have IPV6 enabled, in
which case it ends up calling getipnodebyname .

As a result I'm rather puzzled as to what's causing your problem here...


Michael.
-- 
http://yeoldeclue.com/blog
http://twitter.com/kamaelian
http://www.kamaelia.org/Home

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"kamaelia" group.
To post to this group, send email to kamaelia@googlegroups.com
To unsubscribe from this group, send email to 
kamaelia+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/kamaelia?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to