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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 2900553004: Reporting: Add histograms. (Closed)
Patch Set: oops, forgot about dependency Created 3 years, 7 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/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 203a6e282086e3d0163432a31ff718c723427755..d5fa23d810e42e35fa9e67816ec094a12b0e3949 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -55,6 +55,7 @@
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_retry_info.h"
#include "net/proxy/proxy_service.h"
+#include "net/reporting/reporting_header_parser.h"
#include "net/reporting/reporting_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/ssl_cert_request_info.h"
@@ -850,21 +851,29 @@ void URLRequestHttpJob::ProcessExpectCTHeader() {
void URLRequestHttpJob::ProcessReportToHeader() {
DCHECK(response_info_);
+ HttpResponseHeaders* headers = GetResponseHeaders();
+ std::string value;
+ if (!headers->GetNormalizedHeader("Report-To", &value))
+ return;
+
ReportingService* service = request_->context()->reporting_service();
- if (!service)
+ if (!service) {
+ ReportingHeaderParser::RecordHeaderDiscardedForNoReportingService();
return;
+ }
// Only accept Report-To headers on HTTPS connections that have no
// certificate errors.
// TODO(juliatuttle): Do we need to check cert status?
const SSLInfo& ssl_info = response_info_->ssl_info;
- if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status))
+ if (!ssl_info.is_valid()) {
+ ReportingHeaderParser::RecordHeaderDiscardedForInvalidSSLInfo();
return;
-
- HttpResponseHeaders* headers = GetResponseHeaders();
- std::string value;
- if (!headers->GetNormalizedHeader("Report-To", &value))
+ }
+ if (IsCertStatusError(ssl_info.cert_status)) {
+ ReportingHeaderParser::RecordHeaderDiscardedForCertStatusError();
return;
+ }
service->ProcessHeader(request_info_.url.GetOrigin(), value);
}

Powered by Google App Engine
This is Rietveld 408576698