b.t.h._.ProxyHandler(urllib2.ProxyHandler) : class documentation

Part of bzrlib.transport.http._urllib2_wrappers View In Hierarchy

Handles proxy setting.

Copied and modified from urllib2 to be able to modify the request during the request pre-processing instead of modifying it at _open time. As we capture (or create) the connection object during request processing, _open time was too late.

The main task is to modify the request so that the connection is done to the proxy while the request still refers to the destination host.

Note: the proxy handling may modify the protocol used; the request may be against an https server proxied through an http proxy. So, https_request will be called, but later it's really http_open that will be called. This explains why we don't have to call self.parent.open as the urllib2 did.

Method __init__ Undocumented
Method get_proxy_env_var Get a proxy env var.
Method proxy_bypass Check if host should be proxied or not.
Method evaluate_proxy_bypass Check the host against a comma-separated no_proxy list as a string.
Method set_proxy Undocumented
def __init__(self, proxies=None):
Undocumented
def get_proxy_env_var(self, name, default_to='all'):
Get a proxy env var.

Note that we indirectly rely on urllib.getproxies_environment taking into account the uppercased values for proxy variables.

def proxy_bypass(self, host):
Check if host should be proxied or not.
ReturnsTrue to skip the proxy, False otherwise.
def evaluate_proxy_bypass(self, host, no_proxy):
Check the host against a comma-separated no_proxy list as a string.
Parametershosthost:port being requested
no_proxycomma-separated list of hosts to access directly.
ReturnsTrue to skip the proxy, False not to, or None to leave it to urllib.
def set_proxy(self, request, type):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.