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. |