| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/string_tokenizer.h" | 9 #include "base/string_tokenizer.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return port_; | 77 return port_; |
| 78 } | 78 } |
| 79 | 79 |
| 80 std::string ProxyServer::host_and_port() const { | 80 std::string ProxyServer::host_and_port() const { |
| 81 // Doesn't make sense to call this if the URI scheme doesn't | 81 // Doesn't make sense to call this if the URI scheme doesn't |
| 82 // have concept of a host. | 82 // have concept of a host. |
| 83 DCHECK(is_valid() && !is_direct()); | 83 DCHECK(is_valid() && !is_direct()); |
| 84 return host_ + ":" + IntToString(port_); | 84 return host_ + ":" + IntToString(port_); |
| 85 } | 85 } |
| 86 | 86 |
| 87 HostPortPair ProxyServer::host_port_pair() const { |
| 88 // Doesn't make sense to call this if the URI scheme doesn't |
| 89 // have concept of a host. |
| 90 DCHECK(is_valid() && !is_direct()); |
| 91 return HostPortPair(host_, port_); |
| 92 } |
| 93 |
| 87 // static | 94 // static |
| 88 ProxyServer ProxyServer::FromURI(const std::string& uri, | 95 ProxyServer ProxyServer::FromURI(const std::string& uri, |
| 89 Scheme default_scheme) { | 96 Scheme default_scheme) { |
| 90 return FromURI(uri.begin(), uri.end(), default_scheme); | 97 return FromURI(uri.begin(), uri.end(), default_scheme); |
| 91 } | 98 } |
| 92 | 99 |
| 93 // static | 100 // static |
| 94 ProxyServer ProxyServer::FromURI(std::string::const_iterator begin, | 101 ProxyServer ProxyServer::FromURI(std::string::const_iterator begin, |
| 95 std::string::const_iterator end, | 102 std::string::const_iterator end, |
| 96 Scheme default_scheme) { | 103 Scheme default_scheme) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 222 } |
| 216 | 223 |
| 217 // Choose a default port number if none was given. | 224 // Choose a default port number if none was given. |
| 218 if (port == -1) | 225 if (port == -1) |
| 219 port = GetDefaultPortForScheme(scheme); | 226 port = GetDefaultPortForScheme(scheme); |
| 220 | 227 |
| 221 return ProxyServer(scheme, host, port); | 228 return ProxyServer(scheme, host, port); |
| 222 } | 229 } |
| 223 | 230 |
| 224 } // namespace net | 231 } // namespace net |
| OLD | NEW |