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/basictypes.h" | |
10 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
11 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
12 #include "net/http/http_util.h" | 11 #include "net/http/http_util.h" |
13 | 12 |
14 namespace net { | 13 namespace net { |
15 | 14 |
16 namespace { | 15 namespace { |
17 | 16 |
18 // Parses the proxy type from a PAC string, to a ProxyServer::Scheme. | 17 // Parses the proxy type from a PAC string, to a ProxyServer::Scheme. |
19 // This mapping is case-insensitive. If no type could be matched | 18 // This mapping is case-insensitive. If no type could be matched |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 int port = -1; | 228 int port = -1; |
230 // If the scheme has a host/port, parse it. | 229 // If the scheme has a host/port, parse it. |
231 bool ok = ParseHostAndPort(begin, end, &host, &port); | 230 bool ok = ParseHostAndPort(begin, end, &host, &port); |
232 if (!ok) | 231 if (!ok) |
233 return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>] | 232 return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>] |
234 | 233 |
235 // Choose a default port number if none was given. | 234 // Choose a default port number if none was given. |
236 if (port == -1) | 235 if (port == -1) |
237 port = GetDefaultPortForScheme(scheme); | 236 port = GetDefaultPortForScheme(scheme); |
238 | 237 |
239 host_port_pair = HostPortPair(host, static_cast<uint16>(port)); | 238 host_port_pair = HostPortPair(host, static_cast<uint16_t>(port)); |
240 } | 239 } |
241 | 240 |
242 return ProxyServer(scheme, host_port_pair); | 241 return ProxyServer(scheme, host_port_pair); |
243 } | 242 } |
244 | 243 |
245 } // namespace net | 244 } // namespace net |
OLD | NEW |