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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 1374883002: Add UMAs for checking header values against RFC 7230 in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reflect comments Created 5 years 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/http/http_util_unittest.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/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 2155ea9a54e0c1264b0556580c9e41dd468e8ef2..6565a8dcb8608e759f08b56c6a0b0c033b7e81cc 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -484,6 +484,17 @@ void URLRequestHttpJob::StartTransactionInternal() {
// If we already have a transaction, then we should restart the transaction
// with auth provided by auth_credentials_.
+ bool invalid_header_values_in_rfc7230 = false;
+ for (HttpRequestHeaders::Iterator it(request_info_.extra_headers);
+ it.GetNext();) {
+ if (!HttpUtil::IsValidHeaderValueRFC7230(it.value())) {
+ invalid_header_values_in_rfc7230 = true;
+ break;
+ }
+ }
+ UMA_HISTOGRAM_BOOLEAN("Net.HttpRequest.ContainsInvalidHeaderValuesInRFC7230",
+ invalid_header_values_in_rfc7230);
+
int rv;
if (network_delegate()) {
@@ -928,6 +939,23 @@ void URLRequestHttpJob::OnStartCompleted(int result) {
SetProxyServer(transaction_->GetResponseInfo()->proxy_server);
}
scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders();
+
+ if (headers) {
+ void* iter = NULL;
+ std::string name;
+ std::string value;
+ bool invalid_header_values_in_rfc7230 = false;
+ while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
+ if (!HttpUtil::IsValidHeaderValueRFC7230(value)) {
+ invalid_header_values_in_rfc7230 = true;
+ break;
+ }
+ }
+ UMA_HISTOGRAM_BOOLEAN(
+ "Net.HttpResponse.ContainsInvalidHeaderValuesInRFC7230",
+ invalid_header_values_in_rfc7230);
+ }
+
if (network_delegate()) {
// Note that |this| may not be deleted until
// |on_headers_received_callback_| or
« no previous file with comments | « net/http/http_util_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698