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

Unified Diff: net/dns/host_resolver_proc.cc

Issue 2921553002: Track how often we successfully resolve non-'compliant' domain names. (Closed)
Patch Set: |valid_name| is now a pointer! Created 3 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 | « net/dns/dns_util.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_proc.cc
diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
index 4bed222a21562339d026ea440c2968ce27caca5a..f1253ad9ce9dfdd5ad3ddd142c1829d7fe3b8b49 100644
--- a/net/dns/host_resolver_proc.cc
+++ b/net/dns/host_resolver_proc.cc
@@ -7,6 +7,7 @@
#include "build/build_config.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/sys_byteorder.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
@@ -125,10 +126,14 @@ int SystemHostResolverCall(const std::string& host,
HostResolverFlags host_resolver_flags,
AddressList* addrlist,
int* os_error) {
- // Make sure |host| is properly formed.
+ // Make sure |host| is properly formed. Save the validity check result so that
+ // we can count how often invalid names (see |net::IsValidHostLabelCharacter|)
+ // successfully resolve, if ever. TODO(crbug.com/695474): Remove this when we
+ // no longer need the UMA metrics.
+ bool valid_hostname = false;
{
std::string out_ignored;
- if (!DNSDomainFromDot(host, &out_ignored))
+ if (!DNSDomainFromDotWithValidityCheck(host, &out_ignored, &valid_hostname))
return ERR_NAME_NOT_RESOLVED;
}
@@ -253,6 +258,8 @@ int SystemHostResolverCall(const std::string& host,
*addrlist = AddressList::CreateFromAddrinfo(ai);
freeaddrinfo(ai);
+ UMA_HISTOGRAM_BOOLEAN("Net.SuccessfulResolutionWithValidDNSName",
+ valid_hostname);
return OK;
}
« no previous file with comments | « net/dns/dns_util.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698