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

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

Issue 1629733002: net: move IsHostnameNonUnique() into url_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ssl_errors Created 4 years, 11 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 | « components/ssl_errors/error_classification.cc ('k') | net/base/net_util.cc » ('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) 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class AddressList; 17 class AddressList;
18 18
19 // Returns true if |hostname| contains a non-registerable or non-assignable
20 // domain name (eg: a gTLD that has not been assigned by IANA) or an IP address
21 // that falls in an IANA-reserved range.
22 NET_EXPORT bool IsHostnameNonUnique(const std::string& hostname);
23
24 // Returns the hostname of the current system. Returns empty string on failure. 19 // Returns the hostname of the current system. Returns empty string on failure.
25 NET_EXPORT std::string GetHostName(); 20 NET_EXPORT std::string GetHostName();
26 21
27 // Resolves a local hostname (such as "localhost" or "localhost6") into 22 // Resolves a local hostname (such as "localhost" or "localhost6") into
28 // IP endpoints with the given port. Returns true if |host| is a local 23 // IP endpoints with the given port. Returns true if |host| is a local
29 // hostname and false otherwise. Special IPv6 names (e.g. "localhost6") 24 // hostname and false otherwise. Special IPv6 names (e.g. "localhost6")
30 // will resolve to an IPv6 address only, whereas other names will 25 // will resolve to an IPv6 address only, whereas other names will
31 // resolve to both IPv4 and IPv6. 26 // resolve to both IPv4 and IPv6.
32 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, 27 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host,
33 uint16_t port, 28 uint16_t port,
34 AddressList* address_list); 29 AddressList* address_list);
35 30
36 // Returns true if |host| is one of the local hostnames 31 // Returns true if |host| is one of the local hostnames
37 // (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1). 32 // (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1).
38 // 33 //
39 // Note that this function does not check for IP addresses other than 34 // Note that this function does not check for IP addresses other than
40 // the above, although other IP addresses may point to the local 35 // the above, although other IP addresses may point to the local
41 // machine. 36 // machine.
42 NET_EXPORT bool IsLocalhost(base::StringPiece host); 37 NET_EXPORT bool IsLocalhost(base::StringPiece host);
43 38
44 } // namespace net 39 } // namespace net
45 40
46 #endif // NET_BASE_NET_UTIL_H_ 41 #endif // NET_BASE_NET_UTIL_H_
OLDNEW
« no previous file with comments | « components/ssl_errors/error_classification.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698