| 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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 // We encountered an SSL certificate error. | 834 // We encountered an SSL certificate error. |
| 835 if (result == ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY || | 835 if (result == ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY || |
| 836 result == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN) { | 836 result == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN) { |
| 837 // These are hard failures. They're handled separately and don't have | 837 // These are hard failures. They're handled separately and don't have |
| 838 // the correct cert status, so set it here. | 838 // the correct cert status, so set it here. |
| 839 SSLInfo info(transaction_->GetResponseInfo()->ssl_info); | 839 SSLInfo info(transaction_->GetResponseInfo()->ssl_info); |
| 840 info.cert_status = MapNetErrorToCertStatus(result); | 840 info.cert_status = MapNetErrorToCertStatus(result); |
| 841 NotifySSLCertificateError(info, true); | 841 NotifySSLCertificateError(info, true); |
| 842 } else { | 842 } else { |
| 843 // Maybe overridable, maybe not. Ask the delegate to decide. | 843 // Maybe overridable, maybe not. Ask the delegate to decide. |
| 844 TransportSecurityState::DomainState domain_state; | |
| 845 const URLRequestContext* context = request_->context(); | 844 const URLRequestContext* context = request_->context(); |
| 846 const bool fatal = context->transport_security_state() && | 845 TransportSecurityState* state = context->transport_security_state(); |
| 847 context->transport_security_state()->GetDomainState( | 846 const bool fatal = state && state->ShouldSSLErrorsBeFatal( |
| 848 request_info_.url.host(), | 847 request_info_.url.host(), |
| 849 SSLConfigService::IsSNIAvailable(context->ssl_config_service()), | 848 SSLConfigService::IsSNIAvailable(context->ssl_config_service())); |
| 850 &domain_state) && | |
| 851 domain_state.ShouldSSLErrorsBeFatal(); | |
| 852 NotifySSLCertificateError( | 849 NotifySSLCertificateError( |
| 853 transaction_->GetResponseInfo()->ssl_info, fatal); | 850 transaction_->GetResponseInfo()->ssl_info, fatal); |
| 854 } | 851 } |
| 855 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 852 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| 856 NotifyCertificateRequested( | 853 NotifyCertificateRequested( |
| 857 transaction_->GetResponseInfo()->cert_request_info.get()); | 854 transaction_->GetResponseInfo()->cert_request_info.get()); |
| 858 } else { | 855 } else { |
| 859 // Even on an error, there may be useful information in the response | 856 // Even on an error, there may be useful information in the response |
| 860 // info (e.g. whether there's a cached copy). | 857 // info (e.g. whether there's a cached copy). |
| 861 if (transaction_.get()) | 858 if (transaction_.get()) |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 return override_response_headers_.get() ? | 1501 return override_response_headers_.get() ? |
| 1505 override_response_headers_.get() : | 1502 override_response_headers_.get() : |
| 1506 transaction_->GetResponseInfo()->headers.get(); | 1503 transaction_->GetResponseInfo()->headers.get(); |
| 1507 } | 1504 } |
| 1508 | 1505 |
| 1509 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1506 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1510 awaiting_callback_ = false; | 1507 awaiting_callback_ = false; |
| 1511 } | 1508 } |
| 1512 | 1509 |
| 1513 } // namespace net | 1510 } // namespace net |
| OLD | NEW |