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

Unified Diff: net/http/http_stream_factory_impl_job.cc

Issue 2300533002: Stop caching DER-encoded certificates unnecessarily (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_impl.cc » ('j') | net/socket/ssl_client_socket_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl_job.cc
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index 86e3cee52a7437b139e347667b4108d47aee1c8c..38ef78a01683e5d4c1409d9d0cdfe14e7cc7b31a 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -1470,22 +1470,20 @@ int HttpStreamFactoryImpl::Job::HandleCertificateError(int error) {
static_cast<SSLClientSocket*>(connection_->socket());
ssl_socket->GetSSLInfo(&ssl_info_);
+ if (!ssl_info_.cert) {
+ // If the server's certificate could not be parsed, there is no way
+ // to gracefully recover this, so just pass the error up.
+ return error;
+ }
+
// Add the bad certificate to the set of allowed certificates in the
// SSL config object. This data structure will be consulted after calling
// RestartIgnoringLastError(). And the user will be asked interactively
// before RestartIgnoringLastError() is ever called.
SSLConfig::CertAndStatus bad_cert;
-
- // |ssl_info_.cert| may be NULL if we failed to create
- // X509Certificate for whatever reason, but normally it shouldn't
- // happen, unless this code is used inside sandbox.
- if (ssl_info_.cert.get() == NULL ||
- !X509Certificate::GetDEREncoded(ssl_info_.cert->os_cert_handle(),
- &bad_cert.der_cert)) {
- return error;
- }
+ bad_cert.cert = ssl_info_.cert;
bad_cert.cert_status = ssl_info_.cert_status;
- server_ssl_config_.allowed_bad_certs.push_back(bad_cert);
+ server_ssl_config_.allowed_bad_certs.emplace_back(bad_cert);
davidben 2016/08/31 19:20:49 Same comment as Sergey about why emplace_back vs p
int load_flags = request_info_.load_flags;
if (session_->params().ignore_certificate_errors)
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_impl.cc » ('j') | net/socket/ssl_client_socket_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698