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

Issue 43115: Change the bad-certificate handler for SSL (using NSS) to return an... (Closed)

Created:
11 years, 9 months ago by Markus (顧孟勤)
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

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. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=12809

Patch Set 1 #

Total comments: 9

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 26

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 6

Patch Set 9 : '' #

Total comments: 11

Patch Set 10 : '' #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+653 lines, -179 lines) Patch
M chrome/browser/ssl/ssl_policy.cc View 2 3 4 5 6 7 2 chunks +10 lines, -2 lines 0 comments Download
M net/base/client_socket.h View 7 1 chunk +0 lines, -5 lines 0 comments Download
M net/base/client_socket_pool_unittest.cc View 7 1 chunk +0 lines, -3 lines 0 comments Download
M net/base/ssl_client_socket.h View 4 5 6 7 8 9 1 chunk +1 line, -2 lines 0 comments Download
M net/base/ssl_client_socket_mac.h View 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M net/base/ssl_client_socket_mac.cc View 4 5 6 7 8 9 2 chunks +7 lines, -7 lines 0 comments Download
M net/base/ssl_client_socket_nss.h View 1 2 3 4 5 6 7 8 9 5 chunks +13 lines, -2 lines 0 comments Download
M net/base/ssl_client_socket_nss.cc View 1 2 3 4 5 6 7 8 9 9 chunks +108 lines, -21 lines 0 comments Download
M net/base/ssl_client_socket_unittest.cc View 2 3 4 5 6 7 8 chunks +48 lines, -14 lines 0 comments Download
M net/base/ssl_client_socket_win.h View 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M net/base/ssl_client_socket_win.cc View 4 5 6 7 8 9 2 chunks +7 lines, -7 lines 0 comments Download
M net/base/ssl_config_service.h View 7 8 9 2 chunks +9 lines, -0 lines 1 comment Download
M net/base/tcp_client_socket.h View 7 1 chunk +0 lines, -1 line 0 comments Download
M net/base/tcp_client_socket_libevent.cc View 7 1 chunk +0 lines, -5 lines 0 comments Download
M net/base/tcp_client_socket_win.cc View 7 1 chunk +0 lines, -5 lines 0 comments Download
M net/http/http_network_transaction.h View 1 2 3 4 5 6 7 8 9 2 chunks +8 lines, -8 lines 0 comments Download
M net/http/http_network_transaction.cc View 1 2 3 4 5 6 7 8 9 7 chunks +42 lines, -38 lines 3 comments Download
M net/http/http_network_transaction_unittest.cc View 5 6 7 8 9 9 chunks +321 lines, -50 lines 3 comments Download
M net/url_request/url_request_unittest.h View 2 3 4 5 6 7 6 chunks +16 lines, -4 lines 0 comments Download
M net/url_request/url_request_unittest.cc View 2 3 4 5 6 7 2 chunks +63 lines, -3 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Markus (顧孟勤)
Based on the feedback that I got from you guys for http://codereview.chromium.org/39284 I have come ...
11 years, 9 months ago (2009-03-12 01:28:49 UTC) #1
wtc
Markus, thanks for writing this CL. I will review it this afternoon. Re: failing unit ...
11 years, 9 months ago (2009-03-12 18:19:03 UTC) #2
wtc
Markus, Sorry about the delay in reviewing this CL. Good CL. Unfortunately it forced me ...
11 years, 9 months ago (2009-03-13 01:37:21 UTC) #3
wtc
Markus, Sorry about the delay. Got two meetings today, which interrupted my code review. This ...
11 years, 9 months ago (2009-03-17 23:32:16 UTC) #4
Markus (顧孟勤)
http://codereview.chromium.org/43115/diff/3002/3010 File chrome/browser/ssl/ssl_policy.cc (right): http://codereview.chromium.org/43115/diff/3002/3010#newcode467 Line 467: error->ContinueRequest(); On 2009/03/17 23:32:16, wtc wrote: > Could ...
11 years, 9 months ago (2009-03-19 03:12:11 UTC) #5
dank
Markus, this looks wonderful. I didn't see a test of ReconnectIgnoringLastError in net/base/ssl_client_socket_unittest.cc ? Seems ...
11 years, 9 months ago (2009-03-19 15:27:14 UTC) #6
wtc
Markus, I just started to review your CL. Sorry about the delay. I've been busy ...
11 years, 9 months ago (2009-03-20 22:23:51 UTC) #7
Markus (顧孟勤)
I made a few more changes since last time. In particular, it turned out that ...
11 years, 9 months ago (2009-03-23 02:56:30 UTC) #8
wtc
Hi Markus, I will review your SSLClientSocketStacker API. On 2009/03/23 02:56:30, Markus (顧孟勤) wrote: > ...
11 years, 9 months ago (2009-03-24 00:36:46 UTC) #9
wtc
Markus, After thinking about this more and talking to Darin about it, we'd like to ...
11 years, 9 months ago (2009-03-25 01:29:33 UTC) #10
Markus (顧孟勤)
I changed the code over to the new algorithm that you suggested. That helped clean ...
11 years, 9 months ago (2009-03-26 23:26:31 UTC) #11
Markus (顧孟勤)
Sync'd to the head of the tree. The first time, that went wrong. So, had ...
11 years, 9 months ago (2009-03-27 22:03:20 UTC) #12
wtc
Markus, I reviewed Patch Set 8, and only the most important files http_network_transaction.{h,cc}. Let me ...
11 years, 9 months ago (2009-03-27 22:30:27 UTC) #13
wtc
OK, I have now reviewed all the files. Very nice cleanup. (I didn't review the ...
11 years, 9 months ago (2009-03-27 23:01:20 UTC) #14
Markus (顧孟勤)
I believe, I addressed all of your comments. Would you like to take another look? ...
11 years, 9 months ago (2009-03-28 02:06:55 UTC) #15
wtc
11 years, 8 months ago (2009-03-30 18:18:56 UTC) #16
LGTM.

I reviewed the diffs between Patch Set 8 and Patch Set 10,
and the changes to http_network_transaction.{h,cc}.

Please fix the nits below before you check this in.

I have three comments on http_network_transaction_unittest.cc
below.  If you'd like to address them, you can do that in a
follow-up CL.

I am very happy with the end result.  The SSL-related code
in HttpNetworkTransaction is much simpler now, and the
duplicate code between the "direct SSL" and "SSL over a
tunnel" cases has been eliminated.

http://codereview.chromium.org/43115/diff/8022/7082
File net/base/ssl_config_service.h (right):

http://codereview.chromium.org/43115/diff/8022/7082#newcode31
Line 31: // trigger an ERR_CERT_*_INVALID error when calling
SSLClientSocket::Connect.
Nit: the error should be just ERR_CERT_* because not all
certificate error codes end in _INVALID.  Alternatively you
can just say "a certificate error".

http://codereview.chromium.org/43115/diff/8022/7077
File net/http/http_network_transaction.cc (right):

http://codereview.chromium.org/43115/diff/8022/7077#newcode417
Line 417: TRACE_EVENT_BEGIN("http.connect", request_, request_->url.spec());
Nit: Should we rename this event "http.tcp_connect"?

I hope there are no scripts that depend on the current event
name "http.connect".

http://codereview.chromium.org/43115/diff/8022/7077#newcode422
Line 422: TRACE_EVENT_END("http.connect", request_, request_->url.spec());
Nit: Should we rename this event "http.tcp_connect"?

http://codereview.chromium.org/43115/diff/8022/7077#newcode604
Line 604: // SSL connection, now.  Otherwise, we need to first issue a CONNECT
request.
Nit: remove the comma (,) before "now".

http://codereview.chromium.org/43115/diff/8022/7079
File net/http/http_network_transaction_unittest.cc (right):

http://codereview.chromium.org/43115/diff/8022/7079#newcode32
Line 32: MockConnect(bool a, int r) : async(a), result(r) { }
You may have intentionally named the constructor's parameters
'a' and 'r', right?  I also don't like constructor parameters
having the same names as the members.  I'm surprised that
the initializer list
    : async(async), result(result)
actually works.

http://codereview.chromium.org/43115/diff/8022/7079#newcode69
Line 69: MockSocket(MockRead* r, MockWrite* w) : reads(r), writes(w) { }
Not sure if we need this constructor, but it's ok.

http://codereview.chromium.org/43115/diff/8022/7079#newcode2949
Line 2949: mock_sockets[0] = &ssl_bad_certificate;
It's a little confusing for a socket to be named "ssl_bad_certificate".

Powered by Google App Engine
This is Rietveld 408576698