[issue12480] urllib2 doesn't use proxy (fieddler2), configed the proxy with ProxyHandler

Peter Bumbulis report at bugs.python.org
Tue Jul 26 15:24:32 CEST 2011


Peter Bumbulis <pbumbulis at gmail.com> added the comment:

proxy_bypass_registry in urllib.py does not handle the ProxyOverride registry value properly:  it treats an empty override as *, i.e. bypass the proxy for all hosts.  This behavior does not match other programs (e.g. Chrome) and can be easily obtained by specify * for the override.  One fix would be to ignore empty tests, for example:

    ....
    for test in proxyOverride:
        if test:
            if test == '<local>':
            ...
    return 0
    ....

Perhaps whitespace should be stripped as well.

The problem arises because fiddler2 leaves a trailing ; on the ProxyOverride string.

One possible workaround is to set
    urllib.proxy_bypass = lambda h: 0
to disable bypass checking.  Another alternative would be to specify the proxy settings in the http_proxy environment variable (proxy_bypass_registry is not called in this case).

----------
nosy: +pbumbulis

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


More information about the Python-bugs-list mailing list