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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 int port = -1; | 231 int port = -1; |
232 // If the scheme has a host/port, parse it. | 232 // If the scheme has a host/port, parse it. |
233 bool ok = net::ParseHostAndPort(begin, end, &host, &port); | 233 bool ok = net::ParseHostAndPort(begin, end, &host, &port); |
234 if (!ok) | 234 if (!ok) |
235 return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>] | 235 return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>] |
236 | 236 |
237 // Choose a default port number if none was given. | 237 // Choose a default port number if none was given. |
238 if (port == -1) | 238 if (port == -1) |
239 port = GetDefaultPortForScheme(scheme); | 239 port = GetDefaultPortForScheme(scheme); |
240 | 240 |
241 host_port_pair = HostPortPair(host, port); | 241 host_port_pair = HostPortPair(host, static_cast<uint16>(port)); |
Peter Kasting
2014/11/12 23:54:31
ParseHostAndPort() guarantees that this number wil
| |
242 } | 242 } |
243 | 243 |
244 return ProxyServer(scheme, host_port_pair); | 244 return ProxyServer(scheme, host_port_pair); |
245 } | 245 } |
246 | 246 |
247 } // namespace net | 247 } // namespace net |
OLD | NEW |