| 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 "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 SetStatus(URLRequestStatus()); | 800 SetStatus(URLRequestStatus()); |
| 801 | 801 |
| 802 const URLRequestContext* context = request_->context(); | 802 const URLRequestContext* context = request_->context(); |
| 803 | 803 |
| 804 if (result == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN && | 804 if (result == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN && |
| 805 transaction_->GetResponseInfo() != NULL) { | 805 transaction_->GetResponseInfo() != NULL) { |
| 806 FraudulentCertificateReporter* reporter = | 806 FraudulentCertificateReporter* reporter = |
| 807 context->fraudulent_certificate_reporter(); | 807 context->fraudulent_certificate_reporter(); |
| 808 if (reporter != NULL) { | 808 if (reporter != NULL) { |
| 809 const SSLInfo& ssl_info = transaction_->GetResponseInfo()->ssl_info; | 809 const SSLInfo& ssl_info = transaction_->GetResponseInfo()->ssl_info; |
| 810 bool sni_available = SSLConfigService::IsSNIAvailable( | |
| 811 context->ssl_config_service()); | |
| 812 const std::string& host = request_->url().host(); | 810 const std::string& host = request_->url().host(); |
| 813 | 811 |
| 814 reporter->SendReport(host, ssl_info, sni_available); | 812 reporter->SendReport(host, ssl_info); |
| 815 } | 813 } |
| 816 } | 814 } |
| 817 | 815 |
| 818 if (result == OK) { | 816 if (result == OK) { |
| 819 if (transaction_ && transaction_->GetResponseInfo()) { | 817 if (transaction_ && transaction_->GetResponseInfo()) { |
| 820 SetProxyServer(transaction_->GetResponseInfo()->proxy_server); | 818 SetProxyServer(transaction_->GetResponseInfo()->proxy_server); |
| 821 } | 819 } |
| 822 scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); | 820 scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); |
| 823 if (network_delegate()) { | 821 if (network_delegate()) { |
| 824 // Note that |this| may not be deleted until | 822 // Note that |this| may not be deleted until |
| (...skipping 30 matching lines...) Expand all Loading... |
| 855 // These are hard failures. They're handled separately and don't have | 853 // These are hard failures. They're handled separately and don't have |
| 856 // the correct cert status, so set it here. | 854 // the correct cert status, so set it here. |
| 857 SSLInfo info(transaction_->GetResponseInfo()->ssl_info); | 855 SSLInfo info(transaction_->GetResponseInfo()->ssl_info); |
| 858 info.cert_status = MapNetErrorToCertStatus(result); | 856 info.cert_status = MapNetErrorToCertStatus(result); |
| 859 NotifySSLCertificateError(info, true); | 857 NotifySSLCertificateError(info, true); |
| 860 } else { | 858 } else { |
| 861 // Maybe overridable, maybe not. Ask the delegate to decide. | 859 // Maybe overridable, maybe not. Ask the delegate to decide. |
| 862 const URLRequestContext* context = request_->context(); | 860 const URLRequestContext* context = request_->context(); |
| 863 TransportSecurityState* state = context->transport_security_state(); | 861 TransportSecurityState* state = context->transport_security_state(); |
| 864 const bool fatal = | 862 const bool fatal = |
| 865 state && | 863 state && state->ShouldSSLErrorsBeFatal(request_info_.url.host()); |
| 866 state->ShouldSSLErrorsBeFatal( | |
| 867 request_info_.url.host(), | |
| 868 SSLConfigService::IsSNIAvailable(context->ssl_config_service())); | |
| 869 NotifySSLCertificateError( | 864 NotifySSLCertificateError( |
| 870 transaction_->GetResponseInfo()->ssl_info, fatal); | 865 transaction_->GetResponseInfo()->ssl_info, fatal); |
| 871 } | 866 } |
| 872 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 867 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| 873 NotifyCertificateRequested( | 868 NotifyCertificateRequested( |
| 874 transaction_->GetResponseInfo()->cert_request_info.get()); | 869 transaction_->GetResponseInfo()->cert_request_info.get()); |
| 875 } else { | 870 } else { |
| 876 // Even on an error, there may be useful information in the response | 871 // Even on an error, there may be useful information in the response |
| 877 // info (e.g. whether there's a cached copy). | 872 // info (e.g. whether there's a cached copy). |
| 878 if (transaction_.get()) | 873 if (transaction_.get()) |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 return override_response_headers_.get() ? | 1517 return override_response_headers_.get() ? |
| 1523 override_response_headers_.get() : | 1518 override_response_headers_.get() : |
| 1524 transaction_->GetResponseInfo()->headers.get(); | 1519 transaction_->GetResponseInfo()->headers.get(); |
| 1525 } | 1520 } |
| 1526 | 1521 |
| 1527 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1522 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1528 awaiting_callback_ = false; | 1523 awaiting_callback_ = false; |
| 1529 } | 1524 } |
| 1530 | 1525 |
| 1531 } // namespace net | 1526 } // namespace net |
| OLD | NEW |