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

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: style tweaks, simplification 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') | net/base/net_util.cc » ('J')
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 f2ba404ffddcb18a6bc433fabe7ad1e2991924d5..a830198602184fbad5f4bdc22ea98865a2f7a4b0 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;
@@ -354,6 +356,15 @@ const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address,
NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address,
socklen_t address_len);
+// Resolves a localhost name (such as "localhost" or "localhost6") into
+// IP endpoints with the given port. Returns true if |host| is one of
+// the names that indicate a loopback and false otherwise. Special IPv6
Ryan Sleevi 2015/06/12 01:00:04 Documentation: You seem to mix localhost with loop
estark 2015/06/12 05:59:46 Done.
+// 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 names (e.g. "localhost") or IP
// addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback.
//
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | net/base/net_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698