| 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_service.h" |
| 58 #include "net/ssl/channel_id_service.h" | 59 #include "net/ssl/channel_id_service.h" |
| 59 #include "net/ssl/ssl_cert_request_info.h" | 60 #include "net/ssl/ssl_cert_request_info.h" |
| 60 #include "net/ssl/ssl_config_service.h" | 61 #include "net/ssl/ssl_config_service.h" |
| 61 #include "net/url_request/http_user_agent_settings.h" | 62 #include "net/url_request/http_user_agent_settings.h" |
| 62 #include "net/url_request/url_request.h" | 63 #include "net/url_request/url_request.h" |
| 63 #include "net/url_request/url_request_context.h" | 64 #include "net/url_request/url_request_context.h" |
| 64 #include "net/url_request/url_request_error_job.h" | 65 #include "net/url_request/url_request_error_job.h" |
| 65 #include "net/url_request/url_request_job_factory.h" | 66 #include "net/url_request/url_request_job_factory.h" |
| 66 #include "net/url_request/url_request_redirect_job.h" | 67 #include "net/url_request/url_request_redirect_job.h" |
| 67 #include "net/url_request/url_request_throttler_manager.h" | 68 #include "net/url_request/url_request_throttler_manager.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // also need this info. | 356 // also need this info. |
| 356 is_cached_content_ = response_info_->was_cached; | 357 is_cached_content_ = response_info_->was_cached; |
| 357 | 358 |
| 358 if (!is_cached_content_ && throttling_entry_.get()) | 359 if (!is_cached_content_ && throttling_entry_.get()) |
| 359 throttling_entry_->UpdateWithResponse(GetResponseCode()); | 360 throttling_entry_->UpdateWithResponse(GetResponseCode()); |
| 360 | 361 |
| 361 // The ordering of these calls is not important. | 362 // The ordering of these calls is not important. |
| 362 ProcessStrictTransportSecurityHeader(); | 363 ProcessStrictTransportSecurityHeader(); |
| 363 ProcessPublicKeyPinsHeader(); | 364 ProcessPublicKeyPinsHeader(); |
| 364 ProcessExpectCTHeader(); | 365 ProcessExpectCTHeader(); |
| 366 ProcessReportToHeader(); |
| 365 | 367 |
| 366 // Handle the server notification of a new SDCH dictionary. | 368 // Handle the server notification of a new SDCH dictionary. |
| 367 SdchManager* sdch_manager(request()->context()->sdch_manager()); | 369 SdchManager* sdch_manager(request()->context()->sdch_manager()); |
| 368 if (sdch_manager) { | 370 if (sdch_manager) { |
| 369 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); | 371 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); |
| 370 if (rv != SDCH_OK) { | 372 if (rv != SDCH_OK) { |
| 371 SdchManager::LogSdchProblem(request()->net_log(), rv); | 373 SdchManager::LogSdchProblem(request()->net_log(), rv); |
| 372 } else { | 374 } else { |
| 373 const std::string name = "Get-Dictionary"; | 375 const std::string name = "Get-Dictionary"; |
| 374 std::string url_text; | 376 std::string url_text; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 | 846 |
| 845 // Only process the first Expect-CT header value. | 847 // Only process the first Expect-CT header value. |
| 846 HttpResponseHeaders* headers = GetResponseHeaders(); | 848 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 847 std::string value; | 849 std::string value; |
| 848 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { | 850 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { |
| 849 security_state->ProcessExpectCTHeader( | 851 security_state->ProcessExpectCTHeader( |
| 850 value, HostPortPair::FromURL(request_info_.url), ssl_info); | 852 value, HostPortPair::FromURL(request_info_.url), ssl_info); |
| 851 } | 853 } |
| 852 } | 854 } |
| 853 | 855 |
| 856 void URLRequestHttpJob::ProcessReportToHeader() { |
| 857 DCHECK(response_info_); |
| 858 |
| 859 ReportingService* service = request_->context()->reporting_service(); |
| 860 if (!service) |
| 861 return; |
| 862 |
| 863 // Only accept Report-To headers on HTTPS connections that have no |
| 864 // certificate errors. |
| 865 // TODO(juliatuttle): Do we need to check cert status? |
| 866 const SSLInfo& ssl_info = response_info_->ssl_info; |
| 867 if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status)) |
| 868 return; |
| 869 |
| 870 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 871 std::string value; |
| 872 if (!headers->GetNormalizedHeader("Report-To", &value)) |
| 873 return; |
| 874 |
| 875 service->ProcessHeader(request_info_.url.GetOrigin(), value); |
| 876 } |
| 877 |
| 854 void URLRequestHttpJob::OnStartCompleted(int result) { | 878 void URLRequestHttpJob::OnStartCompleted(int result) { |
| 855 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); | 879 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); |
| 856 RecordTimer(); | 880 RecordTimer(); |
| 857 | 881 |
| 858 // If the job is done (due to cancellation), can just ignore this | 882 // If the job is done (due to cancellation), can just ignore this |
| 859 // notification. | 883 // notification. |
| 860 if (done_) | 884 if (done_) |
| 861 return; | 885 return; |
| 862 | 886 |
| 863 receive_headers_end_ = base::TimeTicks::Now(); | 887 receive_headers_end_ = base::TimeTicks::Now(); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 awaiting_callback_ = false; | 1580 awaiting_callback_ = false; |
| 1557 | 1581 |
| 1558 // Notify NetworkQualityEstimator. | 1582 // Notify NetworkQualityEstimator. |
| 1559 NetworkQualityEstimator* network_quality_estimator = | 1583 NetworkQualityEstimator* network_quality_estimator = |
| 1560 request()->context()->network_quality_estimator(); | 1584 request()->context()->network_quality_estimator(); |
| 1561 if (network_quality_estimator) | 1585 if (network_quality_estimator) |
| 1562 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1586 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1563 } | 1587 } |
| 1564 | 1588 |
| 1565 } // namespace net | 1589 } // namespace net |
| OLD | NEW |