| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // For example: | 63 // For example: |
| 64 // "http=foopy:80;ftp=foopy2" -- use HTTP proxy "foopy:80" for http:// | 64 // "http=foopy:80;ftp=foopy2" -- use HTTP proxy "foopy:80" for http:// |
| 65 // URLs, and HTTP proxy "foopy2:80" for | 65 // URLs, and HTTP proxy "foopy2:80" for |
| 66 // ftp:// URLs. | 66 // ftp:// URLs. |
| 67 // "foopy:80" -- use HTTP proxy "foopy:80" for all URLs. | 67 // "foopy:80" -- use HTTP proxy "foopy:80" for all URLs. |
| 68 // "socks4://foopy" -- use SOCKS v4 proxy "foopy:1080" for all | 68 // "socks4://foopy" -- use SOCKS v4 proxy "foopy:1080" for all |
| 69 // URLs. | 69 // URLs. |
| 70 void ParseFromString(const std::string& proxy_rules); | 70 void ParseFromString(const std::string& proxy_rules); |
| 71 | 71 |
| 72 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp, | 72 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp, |
| 73 // &socks_proxy}, or NULL if it is a scheme that we don't have a mapping | 73 // &fallback_proxy}, or NULL if there is no proxy to use. |
| 74 // for. If the scheme mapping is not present and socks_proxy is defined, | |
| 75 // we fall back to using socks_proxy. | |
| 76 // Should only call this if the type is TYPE_PROXY_PER_SCHEME. | 74 // Should only call this if the type is TYPE_PROXY_PER_SCHEME. |
| 77 const ProxyServer* MapUrlSchemeToProxy(const std::string& url_scheme) const; | 75 const ProxyServer* MapUrlSchemeToProxy(const std::string& url_scheme) const; |
| 78 | 76 |
| 79 // Returns true if |*this| describes the same configuration as |other|. | 77 // Returns true if |*this| describes the same configuration as |other|. |
| 80 bool Equals(const ProxyRules& other) const; | 78 bool Equals(const ProxyRules& other) const; |
| 81 | 79 |
| 82 // Exceptions for when not to use a proxy. | 80 // Exceptions for when not to use a proxy. |
| 83 ProxyBypassRules bypass_rules; | 81 ProxyBypassRules bypass_rules; |
| 84 | 82 |
| 85 // Reverse the meaning of |bypass_rules|. | 83 // Reverse the meaning of |bypass_rules|. |
| 86 bool reverse_bypass; | 84 bool reverse_bypass; |
| 87 | 85 |
| 88 Type type; | 86 Type type; |
| 89 | 87 |
| 90 // Set if |type| is TYPE_SINGLE_PROXY. | 88 // Set if |type| is TYPE_SINGLE_PROXY. |
| 91 ProxyServer single_proxy; | 89 ProxyServer single_proxy; |
| 92 | 90 |
| 93 // Set if |type| is TYPE_PROXY_PER_SCHEME. | 91 // Set if |type| is TYPE_PROXY_PER_SCHEME. |
| 94 ProxyServer proxy_for_http; | 92 ProxyServer proxy_for_http; |
| 95 ProxyServer proxy_for_https; | 93 ProxyServer proxy_for_https; |
| 96 ProxyServer proxy_for_ftp; | 94 ProxyServer proxy_for_ftp; |
| 97 | 95 |
| 98 // Set if the configuration has a SOCKS proxy fallback. | 96 // Used when there isn't a more specific per-scheme proxy server. |
| 99 ProxyServer socks_proxy; | 97 ProxyServer fallback_proxy; |
| 100 | 98 |
| 101 private: | 99 private: |
| 102 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp, | 100 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp} |
| 103 // &socks_proxy}, or NULL if it is a scheme that we don't have a mapping | 101 // or NULL if it is a scheme that we don't have a mapping |
| 104 // for. Should only call this if the type is TYPE_PROXY_PER_SCHEME. | 102 // for. Should only call this if the type is TYPE_PROXY_PER_SCHEME. |
| 105 ProxyServer* MapSchemeToProxy(const std::string& scheme); | 103 ProxyServer* MapUrlSchemeToProxyNoFallback(const std::string& scheme); |
| 106 }; | 104 }; |
| 107 | 105 |
| 108 typedef int ID; | 106 typedef int ID; |
| 109 | 107 |
| 110 // Indicates an invalid proxy config. | 108 // Indicates an invalid proxy config. |
| 111 enum { INVALID_ID = 0 }; | 109 enum { INVALID_ID = 0 }; |
| 112 | 110 |
| 113 ProxyConfig(); | 111 ProxyConfig(); |
| 114 | 112 |
| 115 // Used to numerically identify this configuration. | 113 // Used to numerically identify this configuration. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 ProxyRules proxy_rules_; | 186 ProxyRules proxy_rules_; |
| 189 | 187 |
| 190 int id_; | 188 int id_; |
| 191 }; | 189 }; |
| 192 | 190 |
| 193 } // namespace net | 191 } // namespace net |
| 194 | 192 |
| 195 | 193 |
| 196 | 194 |
| 197 #endif // NET_PROXY_PROXY_CONFIG_H_ | 195 #endif // NET_PROXY_PROXY_CONFIG_H_ |
| OLD | NEW |