diff options
author | markus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-30 21:09:30 +0000 |
---|---|---|
committer | markus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-30 21:09:30 +0000 |
commit | 3fd49f9bdbe56a9648cddc015bdb8bac02fe1a7b (patch) | |
tree | ee0a2b866a939e678bedf426e858871706c41bff /chrome | |
parent | f463787972e54c126d23d263613634d5fd777789 (diff) | |
download | chromium_src-3fd49f9bdbe56a9648cddc015bdb8bac02fe1a7b.zip chromium_src-3fd49f9bdbe56a9648cddc015bdb8bac02fe1a7b.tar.gz chromium_src-3fd49f9bdbe56a9648cddc015bdb8bac02fe1a7b.tar.bz2 |
Change the bad-certificate handler for SSL (using NSS) to return an
error.
This requires a few additional changes in the rest of the code. In
particular, we now have to teach HttpNetworkTransaction about how to
restart connections with bad certificates. This was originally
intended to be done by ReconnectIgnoringLastError(), but that API
turns out be very difficult to implement in the SSLClientSocket. So,
instead, we just create a completely new SSLClientSocket.
We also have to be careful to store a copy of the certificate from
within the bad-certificate handler, as it won't be available by the
time GetSSLInfo() is called.
And we fix a bug that would cause us to erroneously talk SSL on
reconnected TCP sockets, even though we were still supposed to
negotiate a proxy tunnel first.
Review URL: http://codereview.chromium.org/43115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12809 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ssl/ssl_policy.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc index 9e796fa..5221c04 100644 --- a/chrome/browser/ssl/ssl_policy.cc +++ b/chrome/browser/ssl/ssl_policy.cc @@ -318,9 +318,13 @@ SSLErrorInfo SSLPolicy::GetSSLErrorInfo(SSLManager::CertError* error) { void SSLPolicy::OnDenyCertificate(SSLManager::CertError* error) { // Default behavior for rejecting a certificate. - error->CancelRequest(); + // + // While DenyCertForHost() executes synchronously on this thread, + // CancelRequest() gets posted to a different thread. Calling + // DenyCertForHost() first ensures deterministic ordering. error->manager()->DenyCertForHost(error->ssl_info().cert, error->request_url().host()); + error->CancelRequest(); } void SSLPolicy::OnAllowCertificate(SSLManager::CertError* error) { @@ -330,9 +334,13 @@ void SSLPolicy::OnAllowCertificate(SSLManager::CertError* error) { // new NavigationEntry will not be set until DidNavigate. This is ok, // because the new NavigationEntry will have its max security style set // within DidNavigate. - error->ContinueRequest(); + // + // While AllowCertForHost() executes synchronously on this thread, + // ContinueRequest() gets posted to a different thread. Calling + // AllowCertForHost() first ensures deterministic ordering. error->manager()->AllowCertForHost(error->ssl_info().cert, error->request_url().host()); + error->ContinueRequest(); } //////////////////////////////////////////////////////////////////////////////// |