[issue8455] buildbot: test_urllib2_localnet failures (Connection refused) on Tiger buildbot

Alexander Belopolsky report at bugs.python.org
Tue Jun 22 02:37:15 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

Apparently, the failure on OSX is due to the fact that urllib.proxy_bypass('localhost') returns True.  This makes the opener to bypass the ProxyHandler that is explicitly set up to use the correct server port:

    def setUp(self):
        ..
        proxy_url = "http://127.0.0.1:%d" % self.server.port
        handler = urllib2.ProxyHandler({"http" : proxy_url})
        self.proxy_digest_handler = urllib2.ProxyDigestAuthHandler()
        self.opener = urllib2.build_opener(handler, self.proxy_digest_handler)

instead, the opener skips to the default HTTPHandler which attempts to connect on port 80 with sad results.

Interestingly,

>>> urllib.proxy_bypass('127.0.0.1')
False

So the simplest fix is s/localhost/127.0.0.1/ as done in the attached patch (issue8455.diff).

----------
keywords: +patch
nosy: +belopolsky
Added file: http://bugs.python.org/file17737/issue8455.diff

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


More information about the Python-bugs-list mailing list