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

Side by Side Diff: net/base/net_util.h

Issue 1177933002: Resolve RFC 6761 localhost names to loopback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi, mmenke comments Created 5 years, 6 months 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 | « no previous file | net/base/net_util.cc » ('j') | net/dns/host_resolver_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_BASE_NET_UTIL_H_ 5 #ifndef NET_BASE_NET_UTIL_H_
6 #define NET_BASE_NET_UTIL_H_ 6 #define NET_BASE_NET_UTIL_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. 347 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC.
348 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); 348 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family);
349 349
350 // Retuns the port field of the |sockaddr|. 350 // Retuns the port field of the |sockaddr|.
351 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, 351 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address,
352 socklen_t address_len); 352 socklen_t address_len);
353 // Returns the value of port in |sockaddr| (in host byte ordering). 353 // Returns the value of port in |sockaddr| (in host byte ordering).
354 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, 354 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address,
355 socklen_t address_len); 355 socklen_t address_len);
356 356
357 // Returns true if |host| is one of the names (e.g. "localhost") that
358 // indicate a loopback. Sets |isLocalhost6| to true if |host| is one of
359 // the special names (e.g. "localhost6") that indicates an IPv6
360 // loopback.
361 NET_EXPORT_PRIVATE bool IsLocalhostHostname(const std::string& host,
362 bool* isLocalhost6);
363
357 // Returns true if |host| is one of the names (e.g. "localhost") or IP 364 // Returns true if |host| is one of the names (e.g. "localhost") or IP
358 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. 365 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback.
359 // 366 //
360 // Note that this function does not check for IP addresses other than 367 // Note that this function does not check for IP addresses other than
361 // the above, although other IP addresses may point to the local 368 // the above, although other IP addresses may point to the local
362 // machine. 369 // machine.
363 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); 370 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host);
364 371
365 NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host); 372 NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host);
366 373
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 DSCP_CS5 = 40, // Video 419 DSCP_CS5 = 40, // Video
413 DSCP_EF = 46, // Voice 420 DSCP_EF = 46, // Voice
414 DSCP_CS6 = 48, // Voice 421 DSCP_CS6 = 48, // Voice
415 DSCP_CS7 = 56, // Control messages 422 DSCP_CS7 = 56, // Control messages
416 DSCP_LAST = DSCP_CS7 423 DSCP_LAST = DSCP_CS7
417 }; 424 };
418 425
419 } // namespace net 426 } // namespace net
420 427
421 #endif // NET_BASE_NET_UTIL_H_ 428 #endif // NET_BASE_NET_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | net/dns/host_resolver_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698