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

Unified Diff: net/http/transport_security_state.cc

Issue 1850853004: Use CertificateReportSender error callback to record HPKP UMA metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix null dereference Created 4 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
Index: net/http/transport_security_state.cc
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc
index 1d44c5a3a70c854a7aaf80ed630fd8504ec87215..0340d9972916a17e4254056c7cbfc65914befe9f 100644
--- a/net/http/transport_security_state.cc
+++ b/net/http/transport_security_state.cc
@@ -40,6 +40,11 @@ const size_t kMaxHPKPReportCacheEntries = 50;
const int kTimeToRememberHPKPReportsMins = 60;
const size_t kReportCacheKeyLength = 16;
+void RecordUMAForHPKPReportFailure(GURL report_uri, int net_error) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Net.PublicKeyPinReportSendingFailure",
+ net_error);
+}
+
std::string TimeToISO8601(const base::Time& t) {
base::Time::Exploded exploded;
t.UTCExplode(&exploded);
@@ -689,6 +694,8 @@ void TransportSecurityState::SetReportSender(
TransportSecurityState::ReportSender* report_sender) {
DCHECK(CalledOnValidThread());
report_sender_ = report_sender;
+ if (report_sender_)
+ report_sender_->SetErrorCallback(base::Bind(RecordUMAForHPKPReportFailure));
}
void TransportSecurityState::SetExpectCTReporter(

Powered by Google App Engine
This is Rietveld 408576698