Ignoring a proxy with bzr on Windows
John Arbash Meinel
john at arbash-meinel.com
Wed Feb 18 14:24:36 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Adrian Wilkins wrote:
> I also find this rather irksome.
> The issue is that the common Python libraries will read the proxy config
> of IE, but does not run PAC scripts (which are typically JScript).
> If IE is configured statically, I believe that works properly.
> Python will also respect the HTTP_PROXY environment variable, which
> takes precedence over the IE config, but I've not found a way to make it
> say "NO proxy" (using either urllib2 or pycurl).
> Maybe this :
> Would be some help... I'd really like to see something like this in the
> main Python library (batteries included, remember?) since this is such a
> common scenario. I can't believe that all Python developers are lone
> wolves operating outside of a corporate firewall.
> So I don't think this is ultimately a Bazaar issue ; but Bazaar will
> have to cope with it until it improves.
There is the environment variable "NO_PROXY" that we do support. I'm not
entirely sure how it gets set up. But certainly:
def proxy_bypass(self, host):
"""Check if host should be proxied or not"""
no_proxy = self.get_proxy_env_var('no', default_to=None)
if no_proxy is None:
hhost, hport = urllib.splitport(host)
# Does host match any of the domains mentioned in
# no_proxy ? The rules about what is authorized in no_proxy
# are fuzzy (to say the least). We try to allow most
# commonly seen values.
for domain in no_proxy.split(','):
dhost, dport = urllib.splitport(domain)
if hport == dport or dport is None:
# Protect glob chars
dhost = dhost.replace(".", r"\.")
dhost = dhost.replace("*", r".*")
dhost = dhost.replace("?", r".")
if re.match(dhost, hhost, re.IGNORECASE):
# Nevertheless, there are platform-specific ways to
# ignore proxies...
It may also depend if we are using "pycurl" or "urllib". Can you try
setting "no_proxy" and then using "http+urllib://..." ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar