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 #include "net/proxy/proxy_config.h" | 5 #include "net/proxy/proxy_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 // is not a URL scheme. Rather this means "for everything else, send | 123 // is not a URL scheme. Rather this means "for everything else, send |
124 // it to the SOCKS proxy server XXX". | 124 // it to the SOCKS proxy server XXX". |
125 if (url_scheme == "socks") { | 125 if (url_scheme == "socks") { |
126 DCHECK(!entry); | 126 DCHECK(!entry); |
127 entry = &fallback_proxies; | 127 entry = &fallback_proxies; |
128 // Note that here 'socks' is understood to be SOCKS4, even though | 128 // Note that here 'socks' is understood to be SOCKS4, even though |
129 // 'socks' maps to SOCKS5 in ProxyServer::GetSchemeFromURIInternal. | 129 // 'socks' maps to SOCKS5 in ProxyServer::GetSchemeFromURIInternal. |
130 default_scheme = ProxyServer::SCHEME_SOCKS4; | 130 default_scheme = ProxyServer::SCHEME_SOCKS4; |
131 } | 131 } |
132 | 132 |
133 if (entry) { | 133 if (entry) { |
tyoshino (SeeGerritForStatus)
2014/10/27 15:28:29
before this change, MapUrlSchemeToProxyListNoFallb
Adam Rice
2014/10/28 02:22:23
Thank you for catching this.
| |
134 AddProxyURIListToProxyList(proxy_server_for_scheme.token(), | 134 AddProxyURIListToProxyList(proxy_server_for_scheme.token(), |
135 entry, | 135 entry, |
136 default_scheme); | 136 default_scheme); |
137 } | 137 } |
138 } | 138 } |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 const ProxyList* ProxyConfig::ProxyRules::MapUrlSchemeToProxyList( | 142 const ProxyList* ProxyConfig::ProxyRules::MapUrlSchemeToProxyList( |
143 const std::string& url_scheme) const { | 143 const std::string& url_scheme) const { |
(...skipping 19 matching lines...) Expand all Loading... | |
163 | 163 |
164 ProxyList* ProxyConfig::ProxyRules::MapUrlSchemeToProxyListNoFallback( | 164 ProxyList* ProxyConfig::ProxyRules::MapUrlSchemeToProxyListNoFallback( |
165 const std::string& scheme) { | 165 const std::string& scheme) { |
166 DCHECK_EQ(TYPE_PROXY_PER_SCHEME, type); | 166 DCHECK_EQ(TYPE_PROXY_PER_SCHEME, type); |
167 if (scheme == "http") | 167 if (scheme == "http") |
168 return &proxies_for_http; | 168 return &proxies_for_http; |
169 if (scheme == "https") | 169 if (scheme == "https") |
170 return &proxies_for_https; | 170 return &proxies_for_https; |
171 if (scheme == "ftp") | 171 if (scheme == "ftp") |
172 return &proxies_for_ftp; | 172 return &proxies_for_ftp; |
173 if (scheme == "ws" || scheme == "wss") | |
174 return GetProxyListForWebSocketScheme(); | |
173 return NULL; // No mapping for this scheme. | 175 return NULL; // No mapping for this scheme. |
174 } | 176 } |
175 | 177 |
178 ProxyList* ProxyConfig::ProxyRules::GetProxyListForWebSocketScheme() { | |
179 if (!fallback_proxies.IsEmpty()) | |
180 return &fallback_proxies; | |
181 if (!proxies_for_https.IsEmpty()) | |
182 return &proxies_for_https; | |
183 if (!proxies_for_http.IsEmpty()) | |
184 return &proxies_for_http; | |
185 return NULL; | |
186 } | |
187 | |
176 ProxyConfig::ProxyConfig() | 188 ProxyConfig::ProxyConfig() |
177 : auto_detect_(false), pac_mandatory_(false), | 189 : auto_detect_(false), pac_mandatory_(false), |
178 source_(PROXY_CONFIG_SOURCE_UNKNOWN), id_(kInvalidConfigID) { | 190 source_(PROXY_CONFIG_SOURCE_UNKNOWN), id_(kInvalidConfigID) { |
179 } | 191 } |
180 | 192 |
181 ProxyConfig::ProxyConfig(const ProxyConfig& config) | 193 ProxyConfig::ProxyConfig(const ProxyConfig& config) |
182 : auto_detect_(config.auto_detect_), | 194 : auto_detect_(config.auto_detect_), |
183 pac_url_(config.pac_url_), | 195 pac_url_(config.pac_url_), |
184 pac_mandatory_(config.pac_mandatory_), | 196 pac_mandatory_(config.pac_mandatory_), |
185 proxy_rules_(config.proxy_rules_), | 197 proxy_rules_(config.proxy_rules_), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 } | 280 } |
269 } | 281 } |
270 | 282 |
271 // Output the source. | 283 // Output the source. |
272 dict->SetString("source", ProxyConfigSourceToString(source_)); | 284 dict->SetString("source", ProxyConfigSourceToString(source_)); |
273 | 285 |
274 return dict; | 286 return dict; |
275 } | 287 } |
276 | 288 |
277 } // namespace net | 289 } // namespace net |
OLD | NEW |