mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: fix Get() usage in tls_wrap.cc
Backport-PR-URL: https://github.com/nodejs/node/pull/27967 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>
This commit is contained in:
1 parent
b689008dea
commit
f9e8e8856a
1 file changed
+13
-5
+13
-5
@@ -221,8 +221,10 @@ 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);
|
||||
}
|
||||
@@ -232,9 +234,12 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) {
|
||||
// sending HelloRequest in OpenSSL-1.1.1.
|
||||
// We need to check whether this is in a renegotiation state or not.
|
||||
if (where & SSL_CB_HANDSHAKE_DONE && !SSL_renegotiate_pending(ssl)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -845,7 +850,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())
|
||||
|
||||
Reference in new issue
Block a user