OLD | NEW |
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_CONFIG_H_ | 5 #ifndef NET_PROXY_PROXY_CONFIG_H_ |
6 #define NET_PROXY_PROXY_CONFIG_H_ | 6 #define NET_PROXY_PROXY_CONFIG_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... |
35 // If non-empty, indicates the URL of the proxy auto-config file to use. | 35 // If non-empty, indicates the URL of the proxy auto-config file to use. |
36 GURL pac_url; | 36 GURL pac_url; |
37 | 37 |
38 struct ProxyRules { | 38 struct ProxyRules { |
39 enum Type { | 39 enum Type { |
40 TYPE_NO_RULES, | 40 TYPE_NO_RULES, |
41 TYPE_SINGLE_PROXY, | 41 TYPE_SINGLE_PROXY, |
42 TYPE_PROXY_PER_SCHEME, | 42 TYPE_PROXY_PER_SCHEME, |
43 }; | 43 }; |
44 | 44 |
| 45 // Note that the default of TYPE_NO_RULES results in direct connections |
| 46 // being made when using this ProxyConfig. |
45 ProxyRules() : type(TYPE_NO_RULES) {} | 47 ProxyRules() : type(TYPE_NO_RULES) {} |
46 | 48 |
47 bool empty() const { | 49 bool empty() const { |
48 return type == TYPE_NO_RULES; | 50 return type == TYPE_NO_RULES; |
49 } | 51 } |
50 | 52 |
51 // Parses the rules from a string, indicating which proxies to use. | 53 // Parses the rules from a string, indicating which proxies to use. |
52 // | 54 // |
53 // proxy-uri = [<proxy-scheme>://]<proxy-host>[:"<proxy-port>] | 55 // proxy-uri = [<proxy-scheme>://]<proxy-host>[:"<proxy-port>] |
54 // | 56 // |
(...skipping 29 matching lines...) Expand all Loading... |
84 ProxyServer single_proxy; | 86 ProxyServer single_proxy; |
85 | 87 |
86 // Set if |type| is TYPE_PROXY_PER_SCHEME. | 88 // Set if |type| is TYPE_PROXY_PER_SCHEME. |
87 ProxyServer proxy_for_http; | 89 ProxyServer proxy_for_http; |
88 ProxyServer proxy_for_https; | 90 ProxyServer proxy_for_https; |
89 ProxyServer proxy_for_ftp; | 91 ProxyServer proxy_for_ftp; |
90 }; | 92 }; |
91 | 93 |
92 ProxyRules proxy_rules; | 94 ProxyRules proxy_rules; |
93 | 95 |
| 96 // Parses entries from a comma-separated list of hosts for which proxy |
| 97 // configurations should be bypassed. Clears proxy_bypass and sets it to the |
| 98 // resulting list. |
| 99 void ParseNoProxyList(const std::string& no_proxy); |
| 100 |
94 // Indicates a list of hosts that should bypass any proxy configuration. For | 101 // Indicates a list of hosts that should bypass any proxy configuration. For |
95 // these hosts, a direct connection should always be used. | 102 // these hosts, a direct connection should always be used. |
96 // The form <host>:<port> is also supported, meaning that only | 103 // The form <host>:<port> is also supported, meaning that only |
97 // connections on the specified port should be direct. | 104 // connections on the specified port should be direct. |
98 std::vector<std::string> proxy_bypass; | 105 std::vector<std::string> proxy_bypass; |
99 | 106 |
100 // Indicates whether local names (no dots) bypass proxies. | 107 // Indicates whether local names (no dots) bypass proxies. |
101 bool proxy_bypass_local_names; | 108 bool proxy_bypass_local_names; |
102 | 109 |
103 // Returns true if the given config is equivalent to this config. | 110 // Returns true if the given config is equivalent to this config. |
104 bool Equals(const ProxyConfig& other) const; | 111 bool Equals(const ProxyConfig& other) const; |
105 | 112 |
| 113 // Returns true if this config could possibly require the proxy service to |
| 114 // use a PAC resolver. |
| 115 bool MayRequirePACResolver() const; |
| 116 |
106 private: | 117 private: |
107 int id_; | 118 int id_; |
108 }; | 119 }; |
109 | 120 |
110 } // namespace net | 121 } // namespace net |
111 | 122 |
112 // Dumps a human-readable string representation of the configuration to |out|; | 123 // Dumps a human-readable string representation of the configuration to |out|; |
113 // used when logging the configuration changes. | 124 // used when logging the configuration changes. |
114 std::ostream& operator<<(std::ostream& out, const net::ProxyConfig& config); | 125 std::ostream& operator<<(std::ostream& out, const net::ProxyConfig& config); |
115 | 126 |
116 // Dumps a human-readable string representation of the |rules| to |out|; | 127 // Dumps a human-readable string representation of the |rules| to |out|; |
117 // used for logging and for better unittest failure output. | 128 // used for logging and for better unittest failure output. |
118 std::ostream& operator<<(std::ostream& out, | 129 std::ostream& operator<<(std::ostream& out, |
119 const net::ProxyConfig::ProxyRules& rules); | 130 const net::ProxyConfig::ProxyRules& rules); |
120 | 131 |
121 #endif // NET_PROXY_PROXY_CONFIG_H_ | 132 #endif // NET_PROXY_PROXY_CONFIG_H_ |
OLD | NEW |