Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: net/proxy/proxy_server.cc

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
11 #include "net/http/http_util.h" 12 #include "net/http/http_util.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 namespace { 16 namespace {
16 17
17 // Parses the proxy type from a PAC string, to a ProxyServer::Scheme. 18 // Parses the proxy type from a PAC string, to a ProxyServer::Scheme.
18 // This mapping is case-insensitive. If no type could be matched 19 // This mapping is case-insensitive. If no type could be matched
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 int port = -1; 232 int port = -1;
232 // If the scheme has a host/port, parse it. 233 // If the scheme has a host/port, parse it.
233 bool ok = net::ParseHostAndPort(begin, end, &host, &port); 234 bool ok = net::ParseHostAndPort(begin, end, &host, &port);
234 if (!ok) 235 if (!ok)
235 return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>] 236 return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>]
236 237
237 // Choose a default port number if none was given. 238 // Choose a default port number if none was given.
238 if (port == -1) 239 if (port == -1)
239 port = GetDefaultPortForScheme(scheme); 240 port = GetDefaultPortForScheme(scheme);
240 241
241 host_port_pair = HostPortPair(host, port); 242 host_port_pair = HostPortPair(host, static_cast<uint16>(port));
242 } 243 }
243 244
244 return ProxyServer(scheme, host_port_pair); 245 return ProxyServer(scheme, host_port_pair);
245 } 246 }
246 247
247 } // namespace net 248 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698