Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: net/proxy/proxy_info.h

Issue 502068: Remove the implicit fallback to DIRECT when proxies fail. This better matches... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix a comment typo Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_PROXY_PROXY_INFO_H_ 5 #ifndef NET_PROXY_PROXY_INFO_H_
6 #define NET_PROXY_PROXY_INFO_H_ 6 #define NET_PROXY_PROXY_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/proxy/proxy_config.h" 10 #include "net/proxy/proxy_config.h"
(...skipping 25 matching lines...) Expand all
36 36
37 // Set the proxy list to a single entry, |proxy_server|. 37 // Set the proxy list to a single entry, |proxy_server|.
38 void UseProxyServer(const ProxyServer& proxy_server); 38 void UseProxyServer(const ProxyServer& proxy_server);
39 39
40 // Parse from the given PAC result. 40 // Parse from the given PAC result.
41 void UsePacString(const std::string& pac_string) { 41 void UsePacString(const std::string& pac_string) {
42 proxy_list_.SetFromPacString(pac_string); 42 proxy_list_.SetFromPacString(pac_string);
43 } 43 }
44 44
45 // Returns true if this proxy info specifies a direct connection. 45 // Returns true if this proxy info specifies a direct connection.
46 bool is_direct() const { return proxy_list_.Get().is_direct(); } 46 bool is_direct() const {
47 // We don't implicitly fallback to DIRECT unless it was added to the list.
wtc 2010/01/07 20:12:27 Why don't you change ProxyList::Get() to do the ri
eroman 2010/01/07 21:08:19 I don't understand what you mean by this.
wtc 2010/01/07 21:22:09 Right now, you're asking the caller to call ProxyL
48 if (is_empty())
49 return false;
50 return proxy_list_.Get().is_direct();
51 }
47 52
48 // Returns the first valid proxy server. 53 // Returns true if this proxy info has no proxies left to try.
54 bool is_empty() const {
55 return proxy_list_.IsEmpty();
56 }
57
58 // Returns the first valid proxy server. is_empty() must be false to be able
59 // to call this function.
49 ProxyServer proxy_server() const { return proxy_list_.Get(); } 60 ProxyServer proxy_server() const { return proxy_list_.Get(); }
50 61
51 // See description in ProxyList::ToPacString(). 62 // See description in ProxyList::ToPacString().
52 std::string ToPacString(); 63 std::string ToPacString();
53 64
54 // Marks the current proxy as bad. Returns true if there is another proxy 65 // Marks the current proxy as bad. Returns true if there is another proxy
55 // available to try in proxy list_. 66 // available to try in proxy list_.
56 bool Fallback(ProxyRetryInfoMap* proxy_retry_info) { 67 bool Fallback(ProxyRetryInfoMap* proxy_retry_info) {
57 return proxy_list_.Fallback(proxy_retry_info); 68 return proxy_list_.Fallback(proxy_retry_info);
58 } 69 }
59 70
60 // Remove all proxies known to be bad from the proxy list. 71 // Remove all proxies known to be bad from the proxy list.
61 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info) { 72 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info) {
62 proxy_list_.RemoveBadProxies(proxy_retry_info); 73 proxy_list_.RemoveBadProxies(proxy_retry_info);
63 } 74 }
64 75
65 // Delete any entry which doesn't have one of the specified proxy schemes. 76 // Delete any entry which doesn't have one of the specified proxy schemes.
66 void RemoveProxiesWithoutScheme(int scheme_bit_field) { 77 void RemoveProxiesWithoutScheme(int scheme_bit_field) {
67 proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field); 78 proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field);
68 } 79 }
69 80
70 private: 81 private:
71 friend class ProxyService; 82 friend class ProxyService;
72 83
73 // If proxy_list_ is set to empty, then a "direct" connection is indicated. 84 // The ordered list of proxy servers (including DIRECT attempts) remaining to
wtc 2010/01/07 20:12:27 Nit: the word "attempts" is confusing. You can ju
85 // try. If proxy_list_ is empty, then there is nothing left to fall back to.
74 ProxyList proxy_list_; 86 ProxyList proxy_list_;
75 87
76 // This value identifies the proxy config used to initialize this object. 88 // This value identifies the proxy config used to initialize this object.
77 ProxyConfig::ID config_id_; 89 ProxyConfig::ID config_id_;
78
79 // This flag is false when the proxy configuration was known to be bad when
80 // this proxy info was initialized. In such cases, we know that if this
81 // proxy info does not yield a connection that we might want to reconsider
82 // the proxy config given by config_id_.
83 bool config_was_tried_;
84 }; 90 };
85 91
86 } // namespace net 92 } // namespace net
87 93
88 #endif // NET_PROXY_PROXY_INFO_H_ 94 #endif // NET_PROXY_PROXY_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698