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 #include "net/proxy/proxy_server.h" | 5 #include "net/proxy/proxy_server.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 } | 213 } |
214 return -1; | 214 return -1; |
215 } | 215 } |
216 | 216 |
217 // static | 217 // static |
218 ProxyServer::Scheme ProxyServer::GetSchemeFromURI(const std::string& scheme) { | 218 ProxyServer::Scheme ProxyServer::GetSchemeFromURI(const std::string& scheme) { |
219 return GetSchemeFromURIInternal(scheme.begin(), scheme.end()); | 219 return GetSchemeFromURIInternal(scheme.begin(), scheme.end()); |
220 } | 220 } |
221 | 221 |
222 // TODO(bengr): Use |scheme_| to indicate that this is the data reduction proxy. | 222 // TODO(bengr): Use |scheme_| to indicate that this is the data reduction proxy. |
223 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
224 bool ProxyServer::isDataReductionProxy() const { | 223 bool ProxyServer::isDataReductionProxy() const { |
225 bool dev_host = false; | 224 bool dev_host = false; |
226 #if defined (DATA_REDUCTION_DEV_HOST) | 225 #if defined (DATA_REDUCTION_DEV_HOST) |
227 dev_host = host_port_pair_.Equals( | 226 dev_host = host_port_pair_.Equals( |
228 HostPortPair::FromURL(GURL(DATA_REDUCTION_DEV_HOST))); | 227 HostPortPair::FromURL(GURL(DATA_REDUCTION_DEV_HOST))); |
bengr
2014/07/11 20:42:54
We should deprecate and remove ProxyServer::isData
| |
229 #endif | 228 #endif |
230 return dev_host || host_port_pair_.Equals( | 229 return dev_host || host_port_pair_.Equals( |
231 HostPortPair::FromURL(GURL(SPDY_PROXY_AUTH_ORIGIN))); | 230 HostPortPair::FromURL(GURL(SPDY_PROXY_AUTH_ORIGIN))); |
232 } | 231 } |
233 | 232 |
234 bool ProxyServer::isDataReductionProxyFallback() const { | 233 bool ProxyServer::isDataReductionProxyFallback() const { |
235 #if defined(DATA_REDUCTION_FALLBACK_HOST) | 234 #if defined(DATA_REDUCTION_FALLBACK_HOST) |
236 return host_port_pair_.Equals( | 235 return host_port_pair_.Equals( |
237 HostPortPair::FromURL(GURL(DATA_REDUCTION_FALLBACK_HOST))); | 236 HostPortPair::FromURL(GURL(DATA_REDUCTION_FALLBACK_HOST))); |
238 #endif // defined(DATA_REDUCTION_FALLBACK_HOST) | 237 #endif // defined(DATA_REDUCTION_FALLBACK_HOST) |
239 return false; | 238 return false; |
240 } | 239 } |
241 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
242 | 240 |
243 // static | 241 // static |
244 ProxyServer ProxyServer::FromSchemeHostAndPort( | 242 ProxyServer ProxyServer::FromSchemeHostAndPort( |
245 Scheme scheme, | 243 Scheme scheme, |
246 std::string::const_iterator begin, | 244 std::string::const_iterator begin, |
247 std::string::const_iterator end) { | 245 std::string::const_iterator end) { |
248 | 246 |
249 // Trim leading/trailing space. | 247 // Trim leading/trailing space. |
250 HttpUtil::TrimLWS(&begin, &end); | 248 HttpUtil::TrimLWS(&begin, &end); |
251 | 249 |
(...skipping 14 matching lines...) Expand all Loading... | |
266 if (port == -1) | 264 if (port == -1) |
267 port = GetDefaultPortForScheme(scheme); | 265 port = GetDefaultPortForScheme(scheme); |
268 | 266 |
269 host_port_pair = HostPortPair(HostNoBrackets(host), port); | 267 host_port_pair = HostPortPair(HostNoBrackets(host), port); |
270 } | 268 } |
271 | 269 |
272 return ProxyServer(scheme, host_port_pair); | 270 return ProxyServer(scheme, host_port_pair); |
273 } | 271 } |
274 | 272 |
275 } // namespace net | 273 } // namespace net |
OLD | NEW |