OLD | NEW |
---|---|
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 | 476 |
477 void URLRequestHttpJob::StartTransactionInternal() { | 477 void URLRequestHttpJob::StartTransactionInternal() { |
478 // This should only be called while the request's status is IO_PENDING. | 478 // This should only be called while the request's status is IO_PENDING. |
479 DCHECK_EQ(URLRequestStatus::IO_PENDING, request_->status().status()); | 479 DCHECK_EQ(URLRequestStatus::IO_PENDING, request_->status().status()); |
480 | 480 |
481 // NOTE: This method assumes that request_info_ is already setup properly. | 481 // NOTE: This method assumes that request_info_ is already setup properly. |
482 | 482 |
483 // If we already have a transaction, then we should restart the transaction | 483 // If we already have a transaction, then we should restart the transaction |
484 // with auth provided by auth_credentials_. | 484 // with auth provided by auth_credentials_. |
485 | 485 |
486 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.
| |
487 for (HttpRequestHeaders::Iterator it(request_info_.extra_headers); | |
488 it.GetNext();) { | |
489 if (!HttpUtil::IsValidHeaderValueRFC7230(it.value())) { | |
490 invalid_header_values_in_RFC7230 = true; | |
491 break; | |
492 } | |
493 } | |
494 UMA_HISTOGRAM_BOOLEAN("Net.HttpRequestContainsInvalidHeaderValuesInRFC7230", | |
495 invalid_header_values_in_RFC7230); | |
496 | |
486 int rv; | 497 int rv; |
487 | 498 |
488 if (network_delegate()) { | 499 if (network_delegate()) { |
489 network_delegate()->NotifySendHeaders( | 500 network_delegate()->NotifySendHeaders( |
490 request_, request_info_.extra_headers); | 501 request_, request_info_.extra_headers); |
491 } | 502 } |
492 | 503 |
493 if (transaction_.get()) { | 504 if (transaction_.get()) { |
494 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); | 505 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); |
495 auth_credentials_ = AuthCredentials(); | 506 auth_credentials_ = AuthCredentials(); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
925 // Clear the IO_PENDING status | 936 // Clear the IO_PENDING status |
926 SetStatus(URLRequestStatus()); | 937 SetStatus(URLRequestStatus()); |
927 | 938 |
928 const URLRequestContext* context = request_->context(); | 939 const URLRequestContext* context = request_->context(); |
929 | 940 |
930 if (result == OK) { | 941 if (result == OK) { |
931 if (transaction_ && transaction_->GetResponseInfo()) { | 942 if (transaction_ && transaction_->GetResponseInfo()) { |
932 SetProxyServer(transaction_->GetResponseInfo()->proxy_server); | 943 SetProxyServer(transaction_->GetResponseInfo()->proxy_server); |
933 } | 944 } |
934 scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); | 945 scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); |
946 | |
947 if (headers) { | |
948 void* iter = NULL; | |
949 std::string name; | |
950 std::string value; | |
951 bool invalid_header_values_in_RFC7230 = false; | |
952 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | |
953 if (!HttpUtil::IsValidHeaderValueRFC7230(value)) { | |
954 invalid_header_values_in_RFC7230 = true; | |
955 break; | |
956 } | |
957 } | |
958 UMA_HISTOGRAM_BOOLEAN( | |
959 "Net.HttpResponseContainsInvalidHeaderValuesInRFC7230", | |
960 invalid_header_values_in_RFC7230); | |
961 } | |
962 | |
935 if (network_delegate()) { | 963 if (network_delegate()) { |
936 // Note that |this| may not be deleted until | 964 // Note that |this| may not be deleted until |
937 // |on_headers_received_callback_| or | 965 // |on_headers_received_callback_| or |
938 // |NetworkDelegate::URLRequestDestroyed()| has been called. | 966 // |NetworkDelegate::URLRequestDestroyed()| has been called. |
939 OnCallToDelegate(); | 967 OnCallToDelegate(); |
940 allowed_unsafe_redirect_url_ = GURL(); | 968 allowed_unsafe_redirect_url_ = GURL(); |
941 int error = network_delegate()->NotifyHeadersReceived( | 969 int error = network_delegate()->NotifyHeadersReceived( |
942 request_, | 970 request_, |
943 on_headers_received_callback_, | 971 on_headers_received_callback_, |
944 headers.get(), | 972 headers.get(), |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1578 return override_response_headers_.get() ? | 1606 return override_response_headers_.get() ? |
1579 override_response_headers_.get() : | 1607 override_response_headers_.get() : |
1580 transaction_->GetResponseInfo()->headers.get(); | 1608 transaction_->GetResponseInfo()->headers.get(); |
1581 } | 1609 } |
1582 | 1610 |
1583 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1611 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1584 awaiting_callback_ = false; | 1612 awaiting_callback_ = false; |
1585 } | 1613 } |
1586 | 1614 |
1587 } // namespace net | 1615 } // namespace net |
OLD | NEW |