| 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_header_parser.h" |
| 58 #include "net/reporting/reporting_service.h" | 59 #include "net/reporting/reporting_service.h" |
| 59 #include "net/ssl/channel_id_service.h" | 60 #include "net/ssl/channel_id_service.h" |
| 60 #include "net/ssl/ssl_cert_request_info.h" | 61 #include "net/ssl/ssl_cert_request_info.h" |
| 61 #include "net/ssl/ssl_config_service.h" | 62 #include "net/ssl/ssl_config_service.h" |
| 62 #include "net/url_request/http_user_agent_settings.h" | 63 #include "net/url_request/http_user_agent_settings.h" |
| 63 #include "net/url_request/url_request.h" | 64 #include "net/url_request/url_request.h" |
| 64 #include "net/url_request/url_request_context.h" | 65 #include "net/url_request/url_request_context.h" |
| 65 #include "net/url_request/url_request_error_job.h" | 66 #include "net/url_request/url_request_error_job.h" |
| 66 #include "net/url_request/url_request_job_factory.h" | 67 #include "net/url_request/url_request_job_factory.h" |
| 67 #include "net/url_request/url_request_redirect_job.h" | 68 #include "net/url_request/url_request_redirect_job.h" |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 std::string value; | 844 std::string value; |
| 844 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { | 845 if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { |
| 845 security_state->ProcessExpectCTHeader( | 846 security_state->ProcessExpectCTHeader( |
| 846 value, HostPortPair::FromURL(request_info_.url), ssl_info); | 847 value, HostPortPair::FromURL(request_info_.url), ssl_info); |
| 847 } | 848 } |
| 848 } | 849 } |
| 849 | 850 |
| 850 void URLRequestHttpJob::ProcessReportToHeader() { | 851 void URLRequestHttpJob::ProcessReportToHeader() { |
| 851 DCHECK(response_info_); | 852 DCHECK(response_info_); |
| 852 | 853 |
| 853 ReportingService* service = request_->context()->reporting_service(); | |
| 854 if (!service) | |
| 855 return; | |
| 856 | |
| 857 // Only accept Report-To headers on HTTPS connections that have no | |
| 858 // certificate errors. | |
| 859 // TODO(juliatuttle): Do we need to check cert status? | |
| 860 const SSLInfo& ssl_info = response_info_->ssl_info; | |
| 861 if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status)) | |
| 862 return; | |
| 863 | |
| 864 HttpResponseHeaders* headers = GetResponseHeaders(); | 854 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 865 std::string value; | 855 std::string value; |
| 866 if (!headers->GetNormalizedHeader("Report-To", &value)) | 856 if (!headers->GetNormalizedHeader("Report-To", &value)) |
| 867 return; | 857 return; |
| 868 | 858 |
| 859 ReportingService* service = request_->context()->reporting_service(); |
| 860 if (!service) { |
| 861 ReportingHeaderParser::RecordHeaderDiscardedForNoReportingService(); |
| 862 return; |
| 863 } |
| 864 |
| 865 // Only accept Report-To headers on HTTPS connections that have no |
| 866 // certificate errors. |
| 867 // TODO(juliatuttle): Do we need to check cert status? |
| 868 const SSLInfo& ssl_info = response_info_->ssl_info; |
| 869 if (!ssl_info.is_valid()) { |
| 870 ReportingHeaderParser::RecordHeaderDiscardedForInvalidSSLInfo(); |
| 871 return; |
| 872 } |
| 873 if (IsCertStatusError(ssl_info.cert_status)) { |
| 874 ReportingHeaderParser::RecordHeaderDiscardedForCertStatusError(); |
| 875 return; |
| 876 } |
| 877 |
| 869 service->ProcessHeader(request_info_.url.GetOrigin(), value); | 878 service->ProcessHeader(request_info_.url.GetOrigin(), value); |
| 870 } | 879 } |
| 871 | 880 |
| 872 void URLRequestHttpJob::OnStartCompleted(int result) { | 881 void URLRequestHttpJob::OnStartCompleted(int result) { |
| 873 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); | 882 TRACE_EVENT0(kNetTracingCategory, "URLRequestHttpJob::OnStartCompleted"); |
| 874 RecordTimer(); | 883 RecordTimer(); |
| 875 | 884 |
| 876 // If the job is done (due to cancellation), can just ignore this | 885 // If the job is done (due to cancellation), can just ignore this |
| 877 // notification. | 886 // notification. |
| 878 if (done_) | 887 if (done_) |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 awaiting_callback_ = false; | 1583 awaiting_callback_ = false; |
| 1575 | 1584 |
| 1576 // Notify NetworkQualityEstimator. | 1585 // Notify NetworkQualityEstimator. |
| 1577 NetworkQualityEstimator* network_quality_estimator = | 1586 NetworkQualityEstimator* network_quality_estimator = |
| 1578 request()->context()->network_quality_estimator(); | 1587 request()->context()->network_quality_estimator(); |
| 1579 if (network_quality_estimator) | 1588 if (network_quality_estimator) |
| 1580 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1589 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1581 } | 1590 } |
| 1582 | 1591 |
| 1583 } // namespace net | 1592 } // namespace net |
| OLD | NEW |