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

Unified 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 nit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.h
diff --git a/net/base/net_util.h b/net/base/net_util.h
index d08008a0b496ce840a984f93cb83848c0a18d0fa..af826915bdc5bba87da255c110d3ed765d6c00c8 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -42,6 +42,8 @@ struct Parsed;
namespace net {
+class AddressList;
+
// This is a "forward declaration" to avoid including ip_address_number.h
// Keep this in sync.
typedef std::vector<unsigned char> IPAddressNumber;
@@ -349,8 +351,17 @@ const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address,
NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address,
socklen_t address_len);
-// Returns true if |host| is one of the names (e.g. "localhost") or IP
-// addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback.
+// Resolves a local hostname (such as "localhost" or "localhost6") into
+// IP endpoints with the given port. Returns true if |host| is a local
+// hostname and false otherwise. Special IPv6 names (e.g. "localhost6")
+// will resolve to an IPv6 address only, whereas other names will
+// resolve to both IPv4 and IPv6.
+NET_EXPORT_PRIVATE bool ResolveLocalHostname(const std::string& host,
+ uint16_t port,
+ AddressList* address_list);
+
+// Returns true if |host| is one of the local hostnames
+// (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1).
//
// Note that this function does not check for IP addresses other than
// the above, although other IP addresses may point to the local
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698