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

Unified Diff: net/dns/dns_util.h

Issue 2739203003: Measure how often DNS hostnames aren't in preferred name form. (Closed)
Patch Set: Change the behavior to reporting via UMA; add documentation. 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') | net/dns/dns_util.cc » ('J')
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..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(
« no previous file with comments | « no previous file | net/dns/dns_util.cc » ('j') | net/dns/dns_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698