Skip to content

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jun 1, 2018

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 addaleax June 1, 2018 22:02
@jasnell jasnell 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
Member Author

jasnell commented Jun 1, 2018

src/node.cc Outdated
#else
Local<Boolean> tls_ocsp = False(env->isolate());
Local<Boolean> tls_ocsp = falseValue;
Copy link
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

Copy link
Member

@devsnek devsnek left a comment

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

EscapableHandleScope scope(env->isolate());
Isolate* isolate = env->isolate();
EscapableHandleScope scope(isolate);
Local<Boolean> true_value = True(isolate);
Copy link
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?

#else
Local<Value> debug = False(env->isolate());
Local<Boolean> debug = false_value;
Copy link
Contributor

@mscdex mscdex Jun 2, 2018

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) && DEBUG
         True(isolate)
#else
         False(isolate)
#endif
        );

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

@bnoordhuis
Copy link
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
Member Author

jasnell commented Jun 2, 2018

Even better.

@jasnell
Copy link
Member Author

jasnell commented Jun 2, 2018

Closing in favor of #21094!

@jasnell jasnell closed this Jun 2, 2018
Sign up for free to 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 / src Issues and PRs related to general changes in the lib or src directory. process Issues and PRs related to the process subsystem. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants