diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-05 20:09:21 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-05 20:09:21 +0000 |
commit | 69719063c6ddf24d63762a5519efb11dc412a3ee (patch) | |
tree | a12969e6a91c61ec66cdea7d6fd622290256cc16 /net/proxy/proxy_info.h | |
parent | 1515a1d6e4355ef55dc9ea9e1113d4bf0f8362c9 (diff) | |
download | chromium_src-69719063c6ddf24d63762a5519efb11dc412a3ee.zip chromium_src-69719063c6ddf24d63762a5519efb11dc412a3ee.tar.gz chromium_src-69719063c6ddf24d63762a5519efb11dc412a3ee.tar.bz2 |
Remove the implicit fallback to DIRECT when proxies fail. This better matches other browsers, and simplifies the code.
To better understand what this means, here are some examples how the behaviors will differ for the user:
(1) You start chrome with --proxy-server="foobar:80".
The server "foobar:80" is refusing connections.
Before: Would fallback to direct after failing to connect through foobar:80.
Now: Will error-out with connection refused after failing to connect through foobar:80.
(2) You start chrome with --proxy-pac-url="file:///foobar.pac".
The server "foobar:80" is unreachable, and foobar.pac reads:
function FindProxyForURL(url, host) {
return "PROXY foobar:80";
}
Before: Would fallback to direct after failing to connect through foobar:80.
Now: Will error-out with connection refused after failing to connect through foobar:80.
(3) You start chrome with --proxy-pac-url="file:///foobar.pac".
The server "foobar:80" is unreachable, and foobar.pac reads:
function FindProxyForURL(url, host) {
return "PROXY foobar:80; DIRECT";
}
*No change, since the fallback to DIRECT is explicit in the PAC script*
BUG=12303
Review URL: http://codereview.chromium.org/502068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_info.h')
-rw-r--r-- | net/proxy/proxy_info.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/net/proxy/proxy_info.h b/net/proxy/proxy_info.h index 5a386ae..d3097a1 100644 --- a/net/proxy/proxy_info.h +++ b/net/proxy/proxy_info.h @@ -43,9 +43,20 @@ class ProxyInfo { } // Returns true if this proxy info specifies a direct connection. - bool is_direct() const { return proxy_list_.Get().is_direct(); } + bool is_direct() const { + // We don't implicitly fallback to DIRECT unless it was added to the list. + if (is_empty()) + return false; + return proxy_list_.Get().is_direct(); + } + + // Returns true if this proxy info has no proxies left to try. + bool is_empty() const { + return proxy_list_.IsEmpty(); + } - // Returns the first valid proxy server. + // Returns the first valid proxy server. is_empty() must be false to be able + // to call this function. ProxyServer proxy_server() const { return proxy_list_.Get(); } // See description in ProxyList::ToPacString(). @@ -70,17 +81,12 @@ class ProxyInfo { private: friend class ProxyService; - // If proxy_list_ is set to empty, then a "direct" connection is indicated. + // The ordered list of proxy servers (including DIRECT attempts) remaining to + // try. If proxy_list_ is empty, then there is nothing left to fall back to. ProxyList proxy_list_; // This value identifies the proxy config used to initialize this object. ProxyConfig::ID config_id_; - - // This flag is false when the proxy configuration was known to be bad when - // this proxy info was initialized. In such cases, we know that if this - // proxy info does not yield a connection that we might want to reconsider - // the proxy config given by config_id_. - bool config_was_tried_; }; } // namespace net |