Index: net/dns/dns_util.h |
diff --git a/net/dns/dns_util.h b/net/dns/dns_util.h |
index 06cc3d6f8b731e5fe95f96b218afb339528d3036..8bde714f5c6fca9660556a20122946e511de43bf 100644 |
--- a/net/dns/dns_util.h |
+++ b/net/dns/dns_util.h |
@@ -27,6 +27,21 @@ NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, |
// Checks that a hostname is valid. Simple wrapper around DNSDomainFromDot. |
NET_EXPORT_PRIVATE bool IsValidDNSDomain(const base::StringPiece& dotted); |
+// Returns true if the character is valid in a DNS hostname label, whether in |
+// the first position or later in the label. |
+// |
+// This function asserts a looser form of the restrictions in RFC 1123 (section |
Ryan Sleevi
2017/03/22 00:16:07
https://tools.ietf.org/html/rfc7719#section-2 is m
palmer
2017/03/22 01:03:33
Done.
|
+// 2.1): hostnames can include characters a-z, A-Z, 0-9, -, and _, and any of |
+// those characters (except -) are legal in the first position. The looser rules |
+// are necessary to support service records (initial _), and non-compliant but |
+// attested hostnames that include _. These looser rules also allow Punycode and |
+// hence IDN. |
+// |
+// TODO(palmer): In the future, when we can remove support for invalid names, |
+// this can be a private implementation detail of |DNSDomainFromDot|, and need |
+// not be NET_EXPORT_PRIVATE. |
+NET_EXPORT_PRIVATE bool IsValidLabelCharacter(char c, bool is_first_char); |
Ryan Sleevi
2017/03/22 00:16:07
pedantry: IsValidHostLabelCharacter? Since other l
palmer
2017/03/22 01:03:34
Done.
|
+ |
// DNSDomainToString converts a domain in DNS format to a dotted string. |
// Excludes the dot at the end. |
NET_EXPORT_PRIVATE std::string DNSDomainToString( |