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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 416683002: This CL corrects a bug in which the OnHandshakeComplete callback for an ssl session was never called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@r2
Patch Set: Created 6 years, 5 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
Index: net/socket/ssl_client_socket_openssl.cc
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index ed4892ceaf646b6458c5b52528ef8bb924d8eae8..d7f65f855113c15caaa5f54bdd0b29f55604f64c 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -667,6 +667,14 @@ int SSLClientSocketOpenSSL::SetSendBufferSize(int32 size) {
return transport_->socket()->SetSendBufferSize(size);
}
+// static
+void SSLClientSocketOpenSSL::OnSessionFinishedCallback(const SSL* ssl,
+ int result,
+ int unused) {
+ if (result == SSL_CB_HANDSHAKE_DONE)
+ SSLContext::GetInstance()->session_cache()->CheckIfSessionFinished(ssl);
+}
+
int SSLClientSocketOpenSSL::Init() {
DCHECK(!ssl_);
DCHECK(!transport_bio_);
@@ -681,6 +689,9 @@ int SSLClientSocketOpenSSL::Init() {
if (!SSL_set_tlsext_host_name(ssl_, host_and_port_.host().c_str()))
return ERR_UNEXPECTED;
+ // Set an OpenSSL callback to monitor this SSL*'s connection.
+ SSL_set_info_callback(ssl_, &OnSessionFinishedCallback);
+
trying_cached_session_ = context->session_cache()->SetSSLSessionWithKey(
ssl_, GetSessionCacheKey());

Powered by Google App Engine
This is Rietveld 408576698