Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7bd587e

Browse filesBrowse files
committed
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: #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>
1 parent 0b0f023 commit 7bd587e
Copy full SHA for 7bd587e

File tree

Expand file treeCollapse file tree

3 files changed

+11
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-6
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,9 +2991,15 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) {
29912991
goto fire_cb;
29922992

29932993
if (cons->HasInstance(ctx)) {
2994-
SecureContext* sc;
2995-
ASSIGN_OR_RETURN_UNWRAP(&sc, ctx.As<Object>());
2996-
w->sni_context_.Reset(env->isolate(), ctx);
2994+
SecureContext* sc = Unwrap<SecureContext>(ctx.As<Object>());
2995+
CHECK_NOT_NULL(sc);
2996+
// XXX: There is a method w->SetSNIContext(sc), and you might think that
2997+
// it makes sense to call that here and make setting w->sni_context_ part
2998+
// of it. In fact, that passes the test suite, although SetSNIContext()
2999+
// performs a lot more operations.
3000+
// If anybody is familiar enough with the TLS code to know whether it makes
3001+
// sense, please do so or document why it doesn't.
3002+
w->sni_context_ = BaseObjectPtr<SecureContext>(sc);
29973003

29983004
int rv;
29993005

Collapse file

‎src/node_crypto.h‎

Copy file name to clipboardExpand all lines: src/node_crypto.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class SSLWrap {
310310
ClientHelloParser hello_parser_;
311311

312312
v8::Global<v8::ArrayBufferView> ocsp_response_;
313-
v8::Global<v8::Value> sni_context_;
313+
BaseObjectPtr<SecureContext> sni_context_;
314314

315315
friend class SecureContext;
316316
};
Collapse file

‎src/tls_wrap.cc‎

Copy file name to clipboardExpand all lines: src/tls_wrap.cc
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,10 +1065,9 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) {
10651065
return SSL_TLSEXT_ERR_NOACK;
10661066
}
10671067

1068-
p->sni_context_.Reset(env->isolate(), ctx);
1069-
10701068
SecureContext* sc = Unwrap<SecureContext>(ctx.As<Object>());
10711069
CHECK_NOT_NULL(sc);
1070+
p->sni_context_ = BaseObjectPtr<SecureContext>(sc);
10721071
p->SetSNIContext(sc);
10731072
return SSL_TLSEXT_ERR_OK;
10741073
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.