OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LIST_H_ | 5 #ifndef NET_PROXY_PROXY_LIST_H_ |
6 #define NET_PROXY_PROXY_LIST_H_ | 6 #define NET_PROXY_PROXY_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 // Does a best-effort parse, and silently discards any errors. | 71 // Does a best-effort parse, and silently discards any errors. |
72 void SetFromPacString(const std::string& pac_string); | 72 void SetFromPacString(const std::string& pac_string); |
73 | 73 |
74 // Returns a PAC-style semicolon-separated list of valid proxy servers. | 74 // Returns a PAC-style semicolon-separated list of valid proxy servers. |
75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". | 75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". |
76 std::string ToPacString() const; | 76 std::string ToPacString() const; |
77 | 77 |
78 // Returns a serialized value for the list. The caller takes ownership of it. | 78 // Returns a serialized value for the list. The caller takes ownership of it. |
79 base::ListValue* ToValue() const; | 79 base::ListValue* ToValue() const; |
80 | 80 |
81 // Marks the current proxy server as bad and deletes it from the list. The | 81 // Marks the current proxy server as bad and deletes it from the list. The |
82 // list of known bad proxies is given by proxy_retry_info. Returns true if | 82 // list of known bad proxies is given by |proxy_retry_info|. |net_error| |
83 // there is another server available in the list. | 83 // should contain the network error encountered when this proxy was tried if |
Ryan Sleevi
2014/08/15 00:02:23
"tried, if any"
Not at Google. Contact bengr
2014/08/15 17:26:59
Done.
| |
84 // any. If this fallback is not because of a network error, then |OK| should | |
85 // be passed in. Returns true if there is another server available in the | |
Ryan Sleevi
2014/08/15 00:02:24
same comment re: examples of non-error fallbacks
Not at Google. Contact bengr
2014/08/15 17:26:59
Done.
| |
86 // list. | |
84 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, | 87 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, |
88 int net_error, | |
85 const BoundNetLog& net_log); | 89 const BoundNetLog& net_log); |
86 | 90 |
87 // Updates |proxy_retry_info| to indicate that the first proxy in the list | 91 // Updates |proxy_retry_info| to indicate that the first proxy in the list |
88 // is bad. This is distinct from Fallback(), above, to allow updating proxy | 92 // is bad. This is distinct from Fallback(), above, to allow updating proxy |
89 // retry information without modifying a given transction's proxy list. Will | 93 // retry information without modifying a given transction's proxy list. Will |
90 // retry after |retry_delay| if positive, and will use the default proxy retry | 94 // retry after |retry_delay| if positive, and will use the default proxy retry |
91 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| | 95 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| |
92 // is true. Additionally updates |proxy_retry_info| with | 96 // is true. Additionally updates |proxy_retry_info| with |
93 // |another_proxy_to_bypass| if non-empty. | 97 // |another_proxy_to_bypass| if non-empty. |net_error| should contain the |
98 // network error encountered when this proxy was tried, if any. If retry info | |
99 // is not being updated because of a network error, then |OK| should be passed | |
100 // in. | |
94 void UpdateRetryInfoOnFallback( | 101 void UpdateRetryInfoOnFallback( |
95 ProxyRetryInfoMap* proxy_retry_info, | 102 ProxyRetryInfoMap* proxy_retry_info, |
96 base::TimeDelta retry_delay, | 103 base::TimeDelta retry_delay, |
97 bool reconsider, | 104 bool reconsider, |
98 const ProxyServer& another_proxy_to_bypass, | 105 const ProxyServer& another_proxy_to_bypass, |
106 int net_error, | |
99 const BoundNetLog& net_log) const; | 107 const BoundNetLog& net_log) const; |
100 | 108 |
101 private: | 109 private: |
102 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in | 110 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in |
103 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if | 111 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if |
104 // |try_while_bad| is true. | 112 // |try_while_bad| is true. |net_error| should contain the network error |
113 // encountered when this proxy was tried if any, which is responsible for it | |
114 // being put in the retry list. If the proxy is being added to the retry list | |
115 // for a reason other than a network error, then |OK| should be passed in. | |
105 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, | 116 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, |
106 base::TimeDelta retry_delay, | 117 base::TimeDelta retry_delay, |
107 bool try_while_bad, | 118 bool try_while_bad, |
108 const ProxyServer& proxy_to_retry, | 119 const ProxyServer& proxy_to_retry, |
120 int net_error, | |
109 const BoundNetLog& net_log) const; | 121 const BoundNetLog& net_log) const; |
110 | 122 |
111 // List of proxies. | 123 // List of proxies. |
112 std::vector<ProxyServer> proxies_; | 124 std::vector<ProxyServer> proxies_; |
113 }; | 125 }; |
114 | 126 |
115 } // namespace net | 127 } // namespace net |
116 | 128 |
117 #endif // NET_PROXY_PROXY_LIST_H_ | 129 #endif // NET_PROXY_PROXY_LIST_H_ |
OLD | NEW |