| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "net/http/http_status_code.h" | 48 #include "net/http/http_status_code.h" |
| 49 #include "net/http/http_transaction.h" | 49 #include "net/http/http_transaction.h" |
| 50 #include "net/http/http_transaction_factory.h" | 50 #include "net/http/http_transaction_factory.h" |
| 51 #include "net/http/http_util.h" | 51 #include "net/http/http_util.h" |
| 52 #include "net/log/net_log_event_type.h" | 52 #include "net/log/net_log_event_type.h" |
| 53 #include "net/log/net_log_with_source.h" | 53 #include "net/log/net_log_with_source.h" |
| 54 #include "net/nqe/network_quality_estimator.h" | 54 #include "net/nqe/network_quality_estimator.h" |
| 55 #include "net/proxy/proxy_info.h" | 55 #include "net/proxy/proxy_info.h" |
| 56 #include "net/proxy/proxy_retry_info.h" | 56 #include "net/proxy/proxy_retry_info.h" |
| 57 #include "net/proxy/proxy_service.h" | 57 #include "net/proxy/proxy_service.h" |
| 58 #include "net/reporting/reporting_metrics.h" |
| 59 #include "net/reporting/reporting_service.h" |
| 58 #include "net/ssl/channel_id_service.h" | 60 #include "net/ssl/channel_id_service.h" |
| 59 #include "net/ssl/ssl_cert_request_info.h" | 61 #include "net/ssl/ssl_cert_request_info.h" |
| 60 #include "net/ssl/ssl_config_service.h" | 62 #include "net/ssl/ssl_config_service.h" |
| 61 #include "net/url_request/http_user_agent_settings.h" | 63 #include "net/url_request/http_user_agent_settings.h" |
| 62 #include "net/url_request/url_request.h" | 64 #include "net/url_request/url_request.h" |
| 63 #include "net/url_request/url_request_context.h" | 65 #include "net/url_request/url_request_context.h" |
| 64 #include "net/url_request/url_request_error_job.h" | 66 #include "net/url_request/url_request_error_job.h" |
| 65 #include "net/url_request/url_request_job_factory.h" | 67 #include "net/url_request/url_request_job_factory.h" |
| 66 #include "net/url_request/url_request_redirect_job.h" | 68 #include "net/url_request/url_request_redirect_job.h" |
| 67 #include "net/url_request/url_request_throttler_manager.h" | 69 #include "net/url_request/url_request_throttler_manager.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // also need this info. | 363 // also need this info. |
| 362 is_cached_content_ = response_info_->was_cached; | 364 is_cached_content_ = response_info_->was_cached; |
| 363 | 365 |
| 364 if (!is_cached_content_ && throttling_entry_.get()) | 366 if (!is_cached_content_ && throttling_entry_.get()) |
| 365 throttling_entry_->UpdateWithResponse(GetResponseCode()); | 367 throttling_entry_->UpdateWithResponse(GetResponseCode()); |
| 366 | 368 |
| 367 // The ordering of these calls is not important. | 369 // The ordering of these calls is not important. |
| 368 ProcessStrictTransportSecurityHeader(); | 370 ProcessStrictTransportSecurityHeader(); |
| 369 ProcessPublicKeyPinsHeader(); | 371 ProcessPublicKeyPinsHeader(); |
| 370 ProcessExpectCTHeader(); | 372 ProcessExpectCTHeader(); |
| 373 ProcessReportToHeader(); |
| 371 | 374 |
| 372 // Handle the server notification of a new SDCH dictionary. | 375 // Handle the server notification of a new SDCH dictionary. |
| 373 SdchManager* sdch_manager(request()->context()->sdch_manager()); | 376 SdchManager* sdch_manager(request()->context()->sdch_manager()); |
| 374 if (sdch_manager) { | 377 if (sdch_manager) { |
| 375 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); | 378 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); |
| 376 if (rv != SDCH_OK) { | 379 if (rv != SDCH_OK) { |
| 377 SdchManager::LogSdchProblem(request()->net_log(), rv); | 380 SdchManager::LogSdchProblem(request()->net_log(), rv); |
| 378 } else { | 381 } else { |
| 379 const std::string name = "Get-Dictionary"; | 382 const std::string name = "Get-Dictionary"; |
| 380 std::string url_text; | 383 std::string url_text; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 | 856 |
| 854 // Only process the first Expect-CT header value. | 857 // Only process the first Expect-CT header value. |
| 855 HttpResponseHeaders* headers = GetResponseHeaders(); | 858 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 856 std::string value; | 859 std::string value; |
| 857 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { | 860 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { |
| 858 security_state->ProcessExpectCTHeader( | 861 security_state->ProcessExpectCTHeader( |
| 859 value, HostPortPair::FromURL(request_info_.url), ssl_info); | 862 value, HostPortPair::FromURL(request_info_.url), ssl_info); |
| 860 } | 863 } |
| 861 } | 864 } |
| 862 | 865 |
| 866 void URLRequestHttpJob::ProcessReportToHeader() { |
| 867 DCHECK(response_info_); |
| 868 |
| 869 ReportingService* reporting_service = |
| 870 request_->context()->reporting_service(); |
| 871 if (!reporting_service) { |
| 872 HistogramHeader(HEADER_FATE_DROPPED_NO_SERVICE); |
| 873 return; |
| 874 } |
| 875 |
| 876 // Only accept Report-To headers on HTTPS connections that have no |
| 877 // certificate errors. |
| 878 // TODO(juliatuttle): Do we need to check cert status? |
| 879 const SSLInfo& ssl_info = response_info_->ssl_info; |
| 880 if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status)) |
| 881 return; |
| 882 |
| 883 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 884 std::string value; |
| 885 if (!headers->GetNormalizedHeader("Report-To", &value)) |
| 886 return; |
| 887 |
| 888 reporting_service->ProcessHeader(request_info_.url.GetOrigin(), value); |
| 889 } |
| 890 |
| 863 void URLRequestHttpJob::OnStartCompleted(int result) { | 891 void URLRequestHttpJob::OnStartCompleted(int result) { |
| 864 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); | 892 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); |
| 865 RecordTimer(); | 893 RecordTimer(); |
| 866 | 894 |
| 867 // If the job is done (due to cancellation), can just ignore this | 895 // If the job is done (due to cancellation), can just ignore this |
| 868 // notification. | 896 // notification. |
| 869 if (done_) | 897 if (done_) |
| 870 return; | 898 return; |
| 871 | 899 |
| 872 receive_headers_end_ = base::TimeTicks::Now(); | 900 receive_headers_end_ = base::TimeTicks::Now(); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 awaiting_callback_ = false; | 1582 awaiting_callback_ = false; |
| 1555 | 1583 |
| 1556 // Notify NetworkQualityEstimator. | 1584 // Notify NetworkQualityEstimator. |
| 1557 NetworkQualityEstimator* network_quality_estimator = | 1585 NetworkQualityEstimator* network_quality_estimator = |
| 1558 request()->context()->network_quality_estimator(); | 1586 request()->context()->network_quality_estimator(); |
| 1559 if (network_quality_estimator) | 1587 if (network_quality_estimator) |
| 1560 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1588 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1561 } | 1589 } |
| 1562 | 1590 |
| 1563 } // namespace net | 1591 } // namespace net |
| OLD | NEW |