Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
It cost me a while to analyze the cause of the following problem. The symptom was that testing a local web app with twill was fast on Python 2.3, but very slow on Python 2.4-2.6 on a Win XP box. This boiled down to the problem that if you run a SimpleHTTPServer for localhost like this,

Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke c...@online.de: What actually happens is the following: * BaseHTTPServer binds only to the IPv4 address of localhost, because it's based on TCPServer which has address_family=AF_INET by default. * HTTPConnection.connect() however tries to connect to all IP

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
rdmur...@bitdance.com schrieb: Quoth Christoph Zwerschke c...@online.de: With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address first, then the IPv4 address. Since the IPv6 address is checked first,

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke c...@online.de: rdmur...@bitdance.com schrieb: Quoth Christoph Zwerschke c...@online.de: With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address first, then the IPv4 address.

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Steve Holden
rdmur...@bitdance.com wrote: Quoth Christoph Zwerschke c...@online.de: rdmur...@bitdance.com schrieb: Quoth Christoph Zwerschke c...@online.de: With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
Steve Holden schrieb: Search for the subject line socket.create_connection slow - this was discovered by Kristjan Valur Jonsson. It certainly seems like a Microsoft weirdness. Thanks for the pointer, Steve. I hadn't seen that yet. I agree that's actually the real problem here. The solution