summaryrefslogtreecommitdiff
path: root/src/node_crypto.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-19 20:07:00 +0100
committerAnna Henningsen <anna@addaleax.net>2019-11-30 01:14:46 +0100
commitc5a31992b358aa90cffd7b2de8faba28dc2c31ae (patch)
treeb49883eacbabf5389d9f4cb4e0cbdb0f2718d38c /src/node_crypto.cc
parentef0b65f9b03ce29db2d9b8b5a5e5deb6d731d784 (diff)
downloadandroid-node-v8-c5a31992b358aa90cffd7b2de8faba28dc2c31ae.tar.gz
android-node-v8-c5a31992b358aa90cffd7b2de8faba28dc2c31ae.tar.bz2
android-node-v8-c5a31992b358aa90cffd7b2de8faba28dc2c31ae.zip
src: use BaseObjectPtr to store SNI context
Rather than relying on a link to the JS object, store a pointer to the C++ object directly. PR-URL: https://github.com/nodejs/node/pull/30548 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r--src/node_crypto.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 8f80db5229..91704732d1 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -2991,9 +2991,15 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) {
goto fire_cb;
if (cons->HasInstance(ctx)) {
- SecureContext* sc;
- ASSIGN_OR_RETURN_UNWRAP(&sc, ctx.As<Object>());
- w->sni_context_.Reset(env->isolate(), ctx);
+ SecureContext* sc = Unwrap<SecureContext>(ctx.As<Object>());
+ CHECK_NOT_NULL(sc);
+ // XXX: There is a method w->SetSNIContext(sc), and you might think that
+ // it makes sense to call that here and make setting w->sni_context_ part
+ // of it. In fact, that passes the test suite, although SetSNIContext()
+ // performs a lot more operations.
+ // If anybody is familiar enough with the TLS code to know whether it makes
+ // sense, please do so or document why it doesn't.
+ w->sni_context_ = BaseObjectPtr<SecureContext>(sc);
int rv;