| 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 13 matching lines...) Expand all Loading... |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "base/trace_event/trace_event.h" | 25 #include "base/trace_event/trace_event.h" |
| 26 #include "base/values.h" | 26 #include "base/values.h" |
| 27 #include "net/base/host_port_pair.h" | 27 #include "net/base/host_port_pair.h" |
| 28 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
| 29 #include "net/base/net_errors.h" | 29 #include "net/base/net_errors.h" |
| 30 #include "net/base/network_delegate.h" | 30 #include "net/base/network_delegate.h" |
| 31 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 31 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 32 #include "net/base/sdch_manager.h" | 32 #include "net/base/sdch_manager.h" |
| 33 #include "net/base/sdch_problem_codes.h" | 33 #include "net/base/sdch_problem_codes.h" |
| 34 #include "net/base/trace_constants.h" |
| 34 #include "net/base/url_util.h" | 35 #include "net/base/url_util.h" |
| 35 #include "net/cert/cert_status_flags.h" | 36 #include "net/cert/cert_status_flags.h" |
| 36 #include "net/cookies/cookie_store.h" | 37 #include "net/cookies/cookie_store.h" |
| 37 #include "net/filter/brotli_source_stream.h" | 38 #include "net/filter/brotli_source_stream.h" |
| 38 #include "net/filter/filter_source_stream.h" | 39 #include "net/filter/filter_source_stream.h" |
| 39 #include "net/filter/gzip_source_stream.h" | 40 #include "net/filter/gzip_source_stream.h" |
| 40 #include "net/filter/sdch_source_stream.h" | 41 #include "net/filter/sdch_source_stream.h" |
| 41 #include "net/filter/source_stream.h" | 42 #include "net/filter/source_stream.h" |
| 42 #include "net/http/http_content_disposition.h" | 43 #include "net/http/http_content_disposition.h" |
| 43 #include "net/http/http_network_session.h" | 44 #include "net/http/http_network_session.h" |
| (...skipping 804 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 awaiting_callback_ = false; | 1540 awaiting_callback_ = false; |
| 1542 | 1541 |
| 1543 // Notify NetworkQualityEstimator. | 1542 // Notify NetworkQualityEstimator. |
| 1544 NetworkQualityEstimator* network_quality_estimator = | 1543 NetworkQualityEstimator* network_quality_estimator = |
| 1545 request()->context()->network_quality_estimator(); | 1544 request()->context()->network_quality_estimator(); |
| 1546 if (network_quality_estimator) | 1545 if (network_quality_estimator) |
| 1547 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1546 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1548 } | 1547 } |
| 1549 | 1548 |
| 1550 } // namespace net | 1549 } // namespace net |
| OLD | NEW |