| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 // Only process the first Expect-CT header value. | 847 // Only process the first Expect-CT header value. |
| 847 HttpResponseHeaders* headers = GetResponseHeaders(); | 848 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 848 std::string value; | 849 std::string value; |
| 849 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { | 850 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { |
| 850 security_state->ProcessExpectCTHeader( | 851 security_state->ProcessExpectCTHeader( |
| 851 value, HostPortPair::FromURL(request_info_.url), ssl_info); | 852 value, HostPortPair::FromURL(request_info_.url), ssl_info); |
| 852 } | 853 } |
| 853 } | 854 } |
| 854 | 855 |
| 855 void URLRequestHttpJob::OnStartCompleted(int result) { | 856 void URLRequestHttpJob::OnStartCompleted(int result) { |
| 856 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 857 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); |
| 857 "URLRequestHttpJob::OnStartCompleted"); | |
| 858 RecordTimer(); | 858 RecordTimer(); |
| 859 | 859 |
| 860 // If the job is done (due to cancellation), can just ignore this | 860 // If the job is done (due to cancellation), can just ignore this |
| 861 // notification. | 861 // notification. |
| 862 if (done_) | 862 if (done_) |
| 863 return; | 863 return; |
| 864 | 864 |
| 865 receive_headers_end_ = base::TimeTicks::Now(); | 865 receive_headers_end_ = base::TimeTicks::Now(); |
| 866 | 866 |
| 867 const URLRequestContext* context = request_->context(); | 867 const URLRequestContext* context = request_->context(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { | 929 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { |
| 930 awaiting_callback_ = false; | 930 awaiting_callback_ = false; |
| 931 | 931 |
| 932 // Check that there are no callbacks to already canceled requests. | 932 // Check that there are no callbacks to already canceled requests. |
| 933 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 933 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
| 934 | 934 |
| 935 SaveCookiesAndNotifyHeadersComplete(result); | 935 SaveCookiesAndNotifyHeadersComplete(result); |
| 936 } | 936 } |
| 937 | 937 |
| 938 void URLRequestHttpJob::OnReadCompleted(int result) { | 938 void URLRequestHttpJob::OnReadCompleted(int result) { |
| 939 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 939 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnReadCompleted"); |
| 940 "URLRequestHttpJob::OnReadCompleted"); | |
| 941 read_in_progress_ = false; | 940 read_in_progress_ = false; |
| 942 | 941 |
| 943 DCHECK_NE(ERR_IO_PENDING, result); | 942 DCHECK_NE(ERR_IO_PENDING, result); |
| 944 | 943 |
| 945 if (ShouldFixMismatchedContentLength(result)) | 944 if (ShouldFixMismatchedContentLength(result)) |
| 946 result = OK; | 945 result = OK; |
| 947 | 946 |
| 948 // EOF or error, done with this job. | 947 // EOF or error, done with this job. |
| 949 if (result <= 0) | 948 if (result <= 0) |
| 950 DoneWithRequest(FINISHED); | 949 DoneWithRequest(FINISHED); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 awaiting_callback_ = false; | 1547 awaiting_callback_ = false; |
| 1549 | 1548 |
| 1550 // Notify NetworkQualityEstimator. | 1549 // Notify NetworkQualityEstimator. |
| 1551 NetworkQualityEstimator* network_quality_estimator = | 1550 NetworkQualityEstimator* network_quality_estimator = |
| 1552 request()->context()->network_quality_estimator(); | 1551 request()->context()->network_quality_estimator(); |
| 1553 if (network_quality_estimator) | 1552 if (network_quality_estimator) |
| 1554 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1553 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1555 } | 1554 } |
| 1556 | 1555 |
| 1557 } // namespace net | 1556 } // namespace net |
| OLD | NEW |