@@ -104,7 +104,7 @@ X509_STORE* root_cert_store;
104104template class SSLWrap <TLSWrap>;
105105template void SSLWrap<TLSWrap>::AddMethods(Environment* env,
106106 Handle<FunctionTemplate> t);
107- template void SSLWrap<TLSWrap>::InitNPN(TLSWrap* w, SecureContext* sc);
107+ template void SSLWrap<TLSWrap>::InitNPN(SecureContext* sc);
108108template SSL_SESSION* SSLWrap<TLSWrap>::GetSessionCallback(
109109 SSL* s,
110110 unsigned char * key,
@@ -1012,7 +1012,7 @@ void SSLWrap<Base>::AddMethods(Environment* env, Handle<FunctionTemplate> t) {
10121012
10131013
10141014template <class Base >
1015- void SSLWrap<Base>::InitNPN(Base* w, SecureContext* sc) {
1015+ void SSLWrap<Base>::InitNPN(SecureContext* sc) {
10161016#ifdef OPENSSL_NPN_NEGOTIATED
10171017 // Server should advertise NPN protocols
10181018 SSL_CTX_set_next_protos_advertised_cb (sc->ctx_ ,
@@ -1028,8 +1028,6 @@ void SSLWrap<Base>::InitNPN(Base* w, SecureContext* sc) {
10281028 SSL_CTX_set_tlsext_status_cb (sc->ctx_ , TLSExtStatusCallback);
10291029 SSL_CTX_set_tlsext_status_arg (sc->ctx_ , nullptr );
10301030#endif // NODE__HAVE_TLSEXT_STATUS_CB
1031-
1032- SSL_set_cert_cb (w->ssl_ , SSLWrap<Base>::SSLCertCallback, w);
10331031}
10341032
10351033
@@ -2257,7 +2255,7 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
22572255 if (secure_context_constructor_template->HasInstance (ret)) {
22582256 conn->sni_context_ .Reset (env->isolate (), ret);
22592257 SecureContext* sc = Unwrap<SecureContext>(ret.As <Object>());
2260- InitNPN (conn, sc);
2258+ InitNPN (sc);
22612259 SSL_set_SSL_CTX (s, sc->ctx_ );
22622260 } else {
22632261 return SSL_TLSEXT_ERR_NOACK;
@@ -2292,7 +2290,9 @@ void Connection::New(const FunctionCallbackInfo<Value>& args) {
22922290 if (is_server)
22932291 SSL_set_info_callback (conn->ssl_ , SSLInfoCallback);
22942292
2295- InitNPN (conn, sc);
2293+ InitNPN (sc);
2294+
2295+ SSL_set_cert_cb (conn->ssl_ , SSLWrap<Connection>::SSLCertCallback, conn);
22962296
22972297#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
22982298 if (is_server) {
0 commit comments