mirror of https://github.com/nodejs/node.git
src: fix Get() usage in tls_wrap.cc
PR-URL: https://github.com/nodejs/node/pull/24060 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>pull/24060/head
parent
312baacd93
commit
5c9a4b23a8
|
@ -213,17 +213,22 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) {
|
|||
Local<Object> object = c->object();
|
||||
|
||||
if (where & SSL_CB_HANDSHAKE_START) {
|
||||
Local<Value> callback = object->Get(env->onhandshakestart_string());
|
||||
if (callback->IsFunction()) {
|
||||
Local<Value> callback;
|
||||
|
||||
if (object->Get(env->context(), env->onhandshakestart_string())
|
||||
.ToLocal(&callback) && callback->IsFunction()) {
|
||||
Local<Value> argv[] = { env->GetNow() };
|
||||
c->MakeCallback(callback.As<Function>(), arraysize(argv), argv);
|
||||
}
|
||||
}
|
||||
|
||||
if (where & SSL_CB_HANDSHAKE_DONE) {
|
||||
Local<Value> callback;
|
||||
|
||||
c->established_ = true;
|
||||
Local<Value> callback = object->Get(env->onhandshakedone_string());
|
||||
if (callback->IsFunction()) {
|
||||
|
||||
if (object->Get(env->context(), env->onhandshakedone_string())
|
||||
.ToLocal(&callback) && callback->IsFunction()) {
|
||||
c->MakeCallback(callback.As<Function>(), 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -814,7 +819,10 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) {
|
|||
|
||||
// Call the SNI callback and use its return value as context
|
||||
Local<Object> object = p->object();
|
||||
Local<Value> ctx = object->Get(env->sni_context_string());
|
||||
Local<Value> ctx;
|
||||
|
||||
if (!object->Get(env->context(), env->sni_context_string()).ToLocal(&ctx))
|
||||
return SSL_TLSEXT_ERR_NOACK;
|
||||
|
||||
// Not an object, probably undefined or null
|
||||
if (!ctx->IsObject())
|
||||
|
|
Loading…
Reference in New Issue