Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 23908005: Handle all non-overridable SSL errors in the same place (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Accidentally removed whitespace, added back in Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/cert/cert_status_flags.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 NetLog::StringCallback("source", 883 NetLog::StringCallback("source",
884 &source)); 884 &source));
885 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); 885 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error));
886 } 886 }
887 return; 887 return;
888 } 888 }
889 } 889 }
890 890
891 SaveCookiesAndNotifyHeadersComplete(net::OK); 891 SaveCookiesAndNotifyHeadersComplete(net::OK);
892 } else if (IsCertificateError(result)) { 892 } else if (IsCertificateError(result)) {
893 // We encountered an SSL certificate error. Ask our delegate to decide 893 // We encountered an SSL certificate error.
894 // what we should do. 894 if (result == ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY ||
895 895 result == ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN) {
896 TransportSecurityState::DomainState domain_state; 896 // These are hard failures. They're handled separately and don't have
897 const URLRequestContext* context = request_->context(); 897 // the correct cert status, so we set it here.
Ryan Sleevi 2013/09/10 20:51:27 comment nit: Can you drop the "we", leaving the co
felt 2013/09/10 21:03:21 Done.
898 const bool fatal = context->transport_security_state() && 898 SSLInfo info(transaction_->GetResponseInfo()->ssl_info);
899 context->transport_security_state()->GetDomainState( 899 info.cert_status = MapNetErrorToCertStatus(result);
900 request_info_.url.host(), 900 NotifySSLCertificateError(info, true);
901 SSLConfigService::IsSNIAvailable(context->ssl_config_service()), 901 } else {
902 &domain_state) && 902 // Maybe overridable, maybe not.
903 domain_state.ShouldSSLErrorsBeFatal(); 903 // Ask our delegate to decide what we should do.
Ryan Sleevi 2013/09/10 20:51:27 comment nit: // The error may be overridable. Ask
felt 2013/09/10 21:03:21 Done.
904 NotifySSLCertificateError(transaction_->GetResponseInfo()->ssl_info, fatal); 904 TransportSecurityState::DomainState domain_state;
905 const URLRequestContext* context = request_->context();
906 const bool fatal = context->transport_security_state() &&
907 context->transport_security_state()->GetDomainState(
908 request_info_.url.host(),
909 SSLConfigService::IsSNIAvailable(context->ssl_config_service()),
910 &domain_state) &&
911 domain_state.ShouldSSLErrorsBeFatal();
912 NotifySSLCertificateError(
913 transaction_->GetResponseInfo()->ssl_info, fatal);
914 }
905 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { 915 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
906 NotifyCertificateRequested( 916 NotifyCertificateRequested(
907 transaction_->GetResponseInfo()->cert_request_info.get()); 917 transaction_->GetResponseInfo()->cert_request_info.get());
908 } else { 918 } else {
909 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); 919 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
910 } 920 }
911 } 921 }
912 922
913 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { 923 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) {
914 SetUnblockedOnDelegate(); 924 SetUnblockedOnDelegate();
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1514
1505 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1515 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1506 awaiting_callback_ = false; 1516 awaiting_callback_ = false;
1507 } 1517 }
1508 1518
1509 void URLRequestHttpJob::OnDetachRequest() { 1519 void URLRequestHttpJob::OnDetachRequest() {
1510 http_transaction_delegate_->OnDetachRequest(); 1520 http_transaction_delegate_->OnDetachRequest();
1511 } 1521 }
1512 1522
1513 } // namespace net 1523 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_status_flags.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698