| 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) | |
| 227 dev_host = host_port_pair_.Equals( | 225 dev_host = host_port_pair_.Equals( |
| 228 HostPortPair::FromURL(GURL(DATA_REDUCTION_DEV_HOST))); | 226 HostPortPair::FromURL(GURL("http://proxy-dev.googlezip.net:80/"))); |
| 229 #endif | |
| 230 return dev_host || host_port_pair_.Equals( | 227 return dev_host || host_port_pair_.Equals( |
| 231 HostPortPair::FromURL(GURL(SPDY_PROXY_AUTH_ORIGIN))); | 228 HostPortPair::FromURL(GURL("https://proxy.googlezip.net:443/"))); |
| 232 } | 229 } |
| 233 | 230 |
| 234 bool ProxyServer::isDataReductionProxyFallback() const { | 231 bool ProxyServer::isDataReductionProxyFallback() const { |
| 235 #if defined(DATA_REDUCTION_FALLBACK_HOST) | |
| 236 return host_port_pair_.Equals( | 232 return host_port_pair_.Equals( |
| 237 HostPortPair::FromURL(GURL(DATA_REDUCTION_FALLBACK_HOST))); | 233 HostPortPair::FromURL(GURL("http://compress.googlezip.net:80/"))); |
| 238 #endif // defined(DATA_REDUCTION_FALLBACK_HOST) | |
| 239 return false; | 234 return false; |
| 240 } | 235 } |
| 241 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 242 | 236 |
| 243 // static | 237 // static |
| 244 ProxyServer ProxyServer::FromSchemeHostAndPort( | 238 ProxyServer ProxyServer::FromSchemeHostAndPort( |
| 245 Scheme scheme, | 239 Scheme scheme, |
| 246 std::string::const_iterator begin, | 240 std::string::const_iterator begin, |
| 247 std::string::const_iterator end) { | 241 std::string::const_iterator end) { |
| 248 | 242 |
| 249 // Trim leading/trailing space. | 243 // Trim leading/trailing space. |
| 250 HttpUtil::TrimLWS(&begin, &end); | 244 HttpUtil::TrimLWS(&begin, &end); |
| 251 | 245 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 266 if (port == -1) | 260 if (port == -1) |
| 267 port = GetDefaultPortForScheme(scheme); | 261 port = GetDefaultPortForScheme(scheme); |
| 268 | 262 |
| 269 host_port_pair = HostPortPair(HostNoBrackets(host), port); | 263 host_port_pair = HostPortPair(HostNoBrackets(host), port); |
| 270 } | 264 } |
| 271 | 265 |
| 272 return ProxyServer(scheme, host_port_pair); | 266 return ProxyServer(scheme, host_port_pair); |
| 273 } | 267 } |
| 274 | 268 |
| 275 } // namespace net | 269 } // namespace net |
| OLD | NEW |