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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 4213003: Don't resend payload after Snap Start misprediction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 10 years, 1 month 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/third_party/nss/ssl/snapstart.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 5e607782631a2b034445aff47800647420618b14..d13b2a9b9f5773b912b7dc8102da045428ae016b 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -2265,11 +2265,29 @@ int SSLClientSocketNSS::DoVerifyCertComplete(int result) {
// session with a bad cert.
InvalidateSessionIfBadCertificate();
- // Likewise, if we merged a Write call into the handshake we need to make the
+ // If we merged a Write call into the handshake we need to make the
// callback now.
if (user_write_callback_) {
corked_ = false;
- DoWriteCallback(user_write_buf_len_);
+ if (result != OK) {
+ DoWriteCallback(result);
+ } else {
+ SSLSnapStartResult snap_start_type;
+ SECStatus rv = SSL_GetSnapStartResult(nss_fd_, &snap_start_type);
+ DCHECK_EQ(rv, SECSuccess);
+ DCHECK_NE(snap_start_type, SSL_SNAP_START_NONE);
+ if (snap_start_type == SSL_SNAP_START_RECOVERY ||
+ snap_start_type == SSL_SNAP_START_RESUME_RECOVERY) {
+ // If we mispredicted the server's handshake then Snap Start will have
+ // triggered a recovery mode. The misprediction could have been caused
+ // by the server having a different certificate so the application data
+ // wasn't resent. Now that we have verified the certificate, we need to
+ // resend the application data.
+ int bytes_written = DoPayloadWrite();
+ if (bytes_written != ERR_IO_PENDING)
+ DoWriteCallback(bytes_written);
+ }
wtc 2010/11/02 22:29:17 IMPORTANT: I believe we need to add 'else' here, a
+ }
}
// Exit DoHandshakeLoop and return the result to the caller to Connect.
« no previous file with comments | « no previous file | net/third_party/nss/ssl/snapstart.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698