Skip to content

Commit 750b906

Browse files
committed
src: const_cast is necessary for 1.1.1, not 0.9.7
The const_cast used to be necessary for SSL_get_app_data() in OpenSSL 0.9.7, but node doesn't compile against OpenSSL versions that old. However, now it's needed for the recently introduced SSL_renegotiate_pending(), which is not const-correct as of 1.1.1a. PR-URL: nodejs#25861 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 1c3c9f3 commit 750b906

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/tls_wrap.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,9 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) {
211211
if (!(where & (SSL_CB_HANDSHAKE_START | SSL_CB_HANDSHAKE_DONE)))
212212
return;
213213

214-
// Be compatible with older versions of OpenSSL. SSL_get_app_data() wants
215-
// a non-const SSL* in OpenSSL <= 0.9.7e.
214+
// SSL_renegotiate_pending() should take `const SSL*`, but it does not.
216215
SSL* ssl = const_cast<SSL*>(ssl_);
217-
TLSWrap* c = static_cast<TLSWrap*>(SSL_get_app_data(ssl));
216+
TLSWrap* c = static_cast<TLSWrap*>(SSL_get_app_data(ssl_));
218217
Environment* env = c->env();
219218
HandleScope handle_scope(env->isolate());
220219
Context::Scope context_scope(env->context());

0 commit comments

Comments
 (0)