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

Unified Diff: net/dns/dns_util.h

Issue 2739203003: Measure how often DNS hostnames aren't in preferred name form. (Closed)
Patch Set: Rebase. Created 3 years, 9 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/dns/dns_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | net/dns/dns_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698