Part of bzrlib.transport.http._urllib2_wrappers View In Hierarchy
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||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.|
Note that we indirectly rely on urllib.getproxies_environment taking into account the uppercased values for proxy variables.
|Returns||True to skip the proxy, False otherwise.|
|Parameters||host||host:port being requested|
|no_proxy||comma-separated list of hosts to access directly.|
|Returns||True to skip the proxy, False not to, or None to leave it to urllib.|