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

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
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 929d19467a6b5bb4ec4fb19aedcb4f0a77a355a0..bb08d92ee08e43db22a53d596edea0652f21840f 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -483,6 +483,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;
davidben 2015/12/17 20:00:41 Nit: I would lowercase RFC.
hiroshige 2015/12/22 06:33:50 Done.
+ 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.HttpRequestContainsInvalidHeaderValuesInRFC7230",
+ invalid_header_values_in_RFC7230);
+
int rv;
if (network_delegate()) {
@@ -932,6 +943,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.HttpResponseContainsInvalidHeaderValuesInRFC7230",
+ invalid_header_values_in_RFC7230);
+ }
+
if (network_delegate()) {
// Note that |this| may not be deleted until
// |on_headers_received_callback_| or

Powered by Google App Engine
This is Rietveld 408576698