| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "net/http/http_network_session.h" | 43 #include "net/http/http_network_session.h" |
| 44 #include "net/http/http_request_headers.h" | 44 #include "net/http/http_request_headers.h" |
| 45 #include "net/http/http_response_headers.h" | 45 #include "net/http/http_response_headers.h" |
| 46 #include "net/http/http_response_info.h" | 46 #include "net/http/http_response_info.h" |
| 47 #include "net/http/http_status_code.h" | 47 #include "net/http/http_status_code.h" |
| 48 #include "net/http/http_transaction.h" | 48 #include "net/http/http_transaction.h" |
| 49 #include "net/http/http_transaction_factory.h" | 49 #include "net/http/http_transaction_factory.h" |
| 50 #include "net/http/http_util.h" | 50 #include "net/http/http_util.h" |
| 51 #include "net/log/net_log_event_type.h" | 51 #include "net/log/net_log_event_type.h" |
| 52 #include "net/log/net_log_with_source.h" | 52 #include "net/log/net_log_with_source.h" |
| 53 #include "net/log/trace_constants.h" |
| 53 #include "net/nqe/network_quality_estimator.h" | 54 #include "net/nqe/network_quality_estimator.h" |
| 54 #include "net/proxy/proxy_info.h" | 55 #include "net/proxy/proxy_info.h" |
| 55 #include "net/proxy/proxy_retry_info.h" | 56 #include "net/proxy/proxy_retry_info.h" |
| 56 #include "net/proxy/proxy_service.h" | 57 #include "net/proxy/proxy_service.h" |
| 57 #include "net/ssl/channel_id_service.h" | 58 #include "net/ssl/channel_id_service.h" |
| 58 #include "net/ssl/ssl_cert_request_info.h" | 59 #include "net/ssl/ssl_cert_request_info.h" |
| 59 #include "net/ssl/ssl_config_service.h" | 60 #include "net/ssl/ssl_config_service.h" |
| 60 #include "net/url_request/http_user_agent_settings.h" | 61 #include "net/url_request/http_user_agent_settings.h" |
| 61 #include "net/url_request/url_request.h" | 62 #include "net/url_request/url_request.h" |
| 62 #include "net/url_request/url_request_context.h" | 63 #include "net/url_request/url_request_context.h" |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 // Only process the first Expect-CT header value. | 849 // Only process the first Expect-CT header value. |
| 849 HttpResponseHeaders* headers = GetResponseHeaders(); | 850 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 850 std::string value; | 851 std::string value; |
| 851 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { | 852 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { |
| 852 security_state->ProcessExpectCTHeader( | 853 security_state->ProcessExpectCTHeader( |
| 853 value, HostPortPair::FromURL(request_info_.url), ssl_info); | 854 value, HostPortPair::FromURL(request_info_.url), ssl_info); |
| 854 } | 855 } |
| 855 } | 856 } |
| 856 | 857 |
| 857 void URLRequestHttpJob::OnStartCompleted(int result) { | 858 void URLRequestHttpJob::OnStartCompleted(int result) { |
| 858 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 859 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); |
| 859 "URLRequestHttpJob::OnStartCompleted"); | |
| 860 RecordTimer(); | 860 RecordTimer(); |
| 861 | 861 |
| 862 // If the job is done (due to cancellation), can just ignore this | 862 // If the job is done (due to cancellation), can just ignore this |
| 863 // notification. | 863 // notification. |
| 864 if (done_) | 864 if (done_) |
| 865 return; | 865 return; |
| 866 | 866 |
| 867 receive_headers_end_ = base::TimeTicks::Now(); | 867 receive_headers_end_ = base::TimeTicks::Now(); |
| 868 | 868 |
| 869 const URLRequestContext* context = request_->context(); | 869 const URLRequestContext* context = request_->context(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { | 931 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { |
| 932 awaiting_callback_ = false; | 932 awaiting_callback_ = false; |
| 933 | 933 |
| 934 // Check that there are no callbacks to already canceled requests. | 934 // Check that there are no callbacks to already canceled requests. |
| 935 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 935 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
| 936 | 936 |
| 937 SaveCookiesAndNotifyHeadersComplete(result); | 937 SaveCookiesAndNotifyHeadersComplete(result); |
| 938 } | 938 } |
| 939 | 939 |
| 940 void URLRequestHttpJob::OnReadCompleted(int result) { | 940 void URLRequestHttpJob::OnReadCompleted(int result) { |
| 941 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 941 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnReadCompleted"); |
| 942 "URLRequestHttpJob::OnReadCompleted"); | |
| 943 read_in_progress_ = false; | 942 read_in_progress_ = false; |
| 944 | 943 |
| 945 DCHECK_NE(ERR_IO_PENDING, result); | 944 DCHECK_NE(ERR_IO_PENDING, result); |
| 946 | 945 |
| 947 if (ShouldFixMismatchedContentLength(result)) | 946 if (ShouldFixMismatchedContentLength(result)) |
| 948 result = OK; | 947 result = OK; |
| 949 | 948 |
| 950 // EOF or error, done with this job. | 949 // EOF or error, done with this job. |
| 951 if (result <= 0) | 950 if (result <= 0) |
| 952 DoneWithRequest(FINISHED); | 951 DoneWithRequest(FINISHED); |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 awaiting_callback_ = false; | 1537 awaiting_callback_ = false; |
| 1539 | 1538 |
| 1540 // Notify NetworkQualityEstimator. | 1539 // Notify NetworkQualityEstimator. |
| 1541 NetworkQualityEstimator* network_quality_estimator = | 1540 NetworkQualityEstimator* network_quality_estimator = |
| 1542 request()->context()->network_quality_estimator(); | 1541 request()->context()->network_quality_estimator(); |
| 1543 if (network_quality_estimator) | 1542 if (network_quality_estimator) |
| 1544 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1543 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1545 } | 1544 } |
| 1546 | 1545 |
| 1547 } // namespace net | 1546 } // namespace net |
| OLD | NEW |