Skip to content

process,tls: stop relying on process.features - #21087

Closed
jasnell wants to merge 2 commits into
nodejs:masterfrom
jasnell:refactor-process-features
Closed

process,tls: stop relying on process.features#21087
jasnell wants to merge 2 commits into
nodejs:masterfrom
jasnell:refactor-process-features

Conversation

@jasnell

Copy link
Copy Markdown
Member

The process.features property is mutable by userland such that
delete process.features will cause SNI and ALPN support for fail.
Add the necessary properties to process.config('binding') so that
we are not relying on a user-modifiable object.

Also clean up the GetFeatures funciton just a bit.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

The `process.features` property is mutable by userland such that
`delete process.features` will cause SNI and ALPN support for fail.
Add the necessary properties to `process.config('binding')` so that
we are not relying on a user-modifiable object.
Also clean up the `GetFeatures` funciton just a bit.
@jasnell
jasnell requested a review from addaleaxJune 1, 2018 22:02
@jasnelljasnell added tls Issues and PRs related to the tls subsystem. process Issues and PRs related to the process subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jun 1, 2018
@jasnell

Copy link
Copy Markdown
MemberAuthor

Comment threadsrc/node.cc Outdated
Local<Boolean> tls_ocsp = trueValue;
#else
Local<Boolean> tls_ocsp = False(env->isolate());
Local<Boolean> tls_ocsp = falseValue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: true_value and false_value

@devsnekdevsnek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with addaleax's nit fixed

Comment threadsrc/node.cc
EscapableHandleScope scope(env->isolate());
Isolate* isolate = env->isolate();
EscapableHandleScope scope(isolate);
Local<Boolean> true_value = True(isolate);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these two separate variables instead of using True(isolate) and False(isolate) inline like before?

Comment threadsrc/node.cc
Local<Boolean> debug = true_value;
#else
Local<Value> debug = False(env->isolate());
Local<Boolean> debug = false_value;

@mscdexmscdexJun 2, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making this change multiple times, what if we instead removed the temporary variables instead and just set the values directly in the obj->Set() calls? For example:

obj->Set(FIXED_ONE_BYTE_STRING(isolate, "debug"),
#if defined(DEBUG) &&DEBUGTrue(isolate)
#elseFalse(isolate)
#endif
);

or something similar or maybe even write a macro for this?

@bnoordhuis

Copy link
Copy Markdown
Member

In the words of the great poet Zappa: I've got a better idea!

See #21094, we can get rid of the conditionals altogether, they're remnants from when we supported older versions of openssl.

@jasnell

Copy link
Copy Markdown
MemberAuthor

Even better.

@jasnell

Copy link
Copy Markdown
MemberAuthor

Closing in favor of #21094!

@jasnelljasnell closed this Jun 2, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.lib / srcIssues and PRs related to general changes in the lib or src directory.processIssues and PRs related to the process subsystem.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@jasnell@bnoordhuis@mscdex@addaleax@devsnek