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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 2097263002: Deprecate Net.{HttpRequest,Response}.ContainsInvalidHeaderValuesInRFC7230 UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove IsValidHeaderValueRFC7230(). Created 4 years, 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 void URLRequestHttpJob::StartTransactionInternal() { 604 void URLRequestHttpJob::StartTransactionInternal() {
605 // This should only be called while the request's status is IO_PENDING. 605 // This should only be called while the request's status is IO_PENDING.
606 DCHECK_EQ(URLRequestStatus::IO_PENDING, request_->status().status()); 606 DCHECK_EQ(URLRequestStatus::IO_PENDING, request_->status().status());
607 607
608 // NOTE: This method assumes that request_info_ is already setup properly. 608 // NOTE: This method assumes that request_info_ is already setup properly.
609 609
610 // If we already have a transaction, then we should restart the transaction 610 // If we already have a transaction, then we should restart the transaction
611 // with auth provided by auth_credentials_. 611 // with auth provided by auth_credentials_.
612 612
613 bool invalid_header_values_in_rfc7230 = false;
614 for (HttpRequestHeaders::Iterator it(request_info_.extra_headers);
615 it.GetNext();) {
616 if (!HttpUtil::IsValidHeaderValueRFC7230(it.value())) {
617 invalid_header_values_in_rfc7230 = true;
618 break;
619 }
620 }
621 UMA_HISTOGRAM_BOOLEAN("Net.HttpRequest.ContainsInvalidHeaderValuesInRFC7230",
622 invalid_header_values_in_rfc7230);
623
624 int rv; 613 int rv;
625 614
626 // Notify NetworkQualityEstimator. 615 // Notify NetworkQualityEstimator.
627 NetworkQualityEstimator* network_quality_estimator = 616 NetworkQualityEstimator* network_quality_estimator =
628 request()->context()->network_quality_estimator(); 617 request()->context()->network_quality_estimator();
629 if (network_quality_estimator) 618 if (network_quality_estimator)
630 network_quality_estimator->NotifyStartTransaction(*request_); 619 network_quality_estimator->NotifyStartTransaction(*request_);
631 620
632 if (network_delegate()) { 621 if (network_delegate()) {
633 network_delegate()->NotifyStartTransaction(request_, 622 network_delegate()->NotifyStartTransaction(request_,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 receive_headers_end_ = base::TimeTicks::Now(); 1015 receive_headers_end_ = base::TimeTicks::Now();
1027 1016
1028 const URLRequestContext* context = request_->context(); 1017 const URLRequestContext* context = request_->context();
1029 1018
1030 if (result == OK) { 1019 if (result == OK) {
1031 if (transaction_ && transaction_->GetResponseInfo()) { 1020 if (transaction_ && transaction_->GetResponseInfo()) {
1032 SetProxyServer(transaction_->GetResponseInfo()->proxy_server); 1021 SetProxyServer(transaction_->GetResponseInfo()->proxy_server);
1033 } 1022 }
1034 scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); 1023 scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders();
1035 1024
1036 if (headers) {
1037 size_t iter = 0;
1038 std::string name;
1039 std::string value;
1040 bool invalid_header_values_in_rfc7230 = false;
1041 while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
1042 if (!HttpUtil::IsValidHeaderValueRFC7230(value)) {
1043 invalid_header_values_in_rfc7230 = true;
1044 break;
1045 }
1046 }
1047 UMA_HISTOGRAM_BOOLEAN(
1048 "Net.HttpResponse.ContainsInvalidHeaderValuesInRFC7230",
1049 invalid_header_values_in_rfc7230);
1050 }
1051
1052 if (network_delegate()) { 1025 if (network_delegate()) {
1053 // Note that |this| may not be deleted until 1026 // Note that |this| may not be deleted until
1054 // |on_headers_received_callback_| or 1027 // |on_headers_received_callback_| or
1055 // |NetworkDelegate::URLRequestDestroyed()| has been called. 1028 // |NetworkDelegate::URLRequestDestroyed()| has been called.
1056 OnCallToDelegate(); 1029 OnCallToDelegate();
1057 allowed_unsafe_redirect_url_ = GURL(); 1030 allowed_unsafe_redirect_url_ = GURL();
1058 int error = network_delegate()->NotifyHeadersReceived( 1031 int error = network_delegate()->NotifyHeadersReceived(
1059 request_, 1032 request_,
1060 on_headers_received_callback_, 1033 on_headers_received_callback_,
1061 headers.get(), 1034 headers.get(),
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 // Notify NetworkQualityEstimator. 1651 // Notify NetworkQualityEstimator.
1679 if (request()) { 1652 if (request()) {
1680 NetworkQualityEstimator* network_quality_estimator = 1653 NetworkQualityEstimator* network_quality_estimator =
1681 request()->context()->network_quality_estimator(); 1654 request()->context()->network_quality_estimator();
1682 if (network_quality_estimator) 1655 if (network_quality_estimator)
1683 network_quality_estimator->NotifyURLRequestDestroyed(*request()); 1656 network_quality_estimator->NotifyURLRequestDestroyed(*request());
1684 } 1657 }
1685 } 1658 }
1686 1659
1687 } // namespace net 1660 } // namespace net
OLDNEW
« 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