Index: net/dns/dns_util.h |
diff --git a/net/dns/dns_util.h b/net/dns/dns_util.h |
index 06cc3d6f8b731e5fe95f96b218afb339528d3036..81eb1a28ba11dd57a0af00b91c9f69274babe707 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 7719 (section |
+// 2; https://tools.ietf.org/html/rfc7719#section-2): 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 IsValidHostLabelCharacter(char c, bool is_first_char); |
+ |
// DNSDomainToString converts a domain in DNS format to a dotted string. |
// Excludes the dot at the end. |
NET_EXPORT_PRIVATE std::string DNSDomainToString( |