Skip to content

Commit

Permalink
crypto: fix legacy SNICallback
Browse files Browse the repository at this point in the history
`onselect` is set on the `sniObject_` not on the `Connection` instance.

See: nodejs/node-v0.x-archive#25109
  • Loading branch information
indutny committed May 17, 2015
1 parent 6edc900 commit 79d647d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2266,8 +2266,15 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
if (!conn->sniObject_.IsEmpty()) {
conn->sni_context_.Reset();

Local<Object> sni_obj = PersistentToLocal(env->isolate(),
conn->sniObject_);

Local<Value> arg = PersistentToLocal(env->isolate(), conn->servername_);
Local<Value> ret = conn->MakeCallback(env->onselect_string(), 1, &arg);
Local<Value> ret = node::MakeCallback(env->isolate(),
sni_obj,
env->onselect_string(),
1,
&arg);

// If ret is SecureContext
Local<FunctionTemplate> secure_context_constructor_template =
Expand Down

0 comments on commit 79d647d

Please sign in to comment.