| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
This would make it look like less of a mistake (using loose quality instead of strict equality) since strict equality is used more often than not:
| if (pfx != null) { | |
| if (pfx !== undefined && pfx !== null) { |
Sorry, something went wrong.
There was a problem hiding this comment.
I prefer this pattern as well.
Sorry, something went wrong.
There was a problem hiding this comment.
I quite like != null pattern, especially since optional chaining and null coalescing are a thing 🤷♂️
Sorry, something went wrong.
There was a problem hiding this comment.
Agreed. I prefer the same because strict equality more verbose. I was following the previous PR in the issue... So I'll include the strict for ciphers option also.
Sorry, something went wrong.
|
Hold on, let me include dhparam, crl and sessionIdContext to allow null soon as per comment in the issue. |
Sorry, something went wrong.
Allow null along with undefined for pfx value. This is to avoid breaking change when upgrading v14 to v16 and 3rd party library passing null to pfx Fixes: nodejs#36292
Allow the expected null along with undefined for options value. This is to avoid breaking change when upgrading v14 to v16 and 3rd party library passing null to options Fixes: nodejs#36292
|
@mcollina done. I just check null value against the remaining options above but it seems like most of the options throw TypeError [ERR_INVALID_ARG_TYPE] due to null not considered as default undefined. So I fix all similar options to skip null just like undefined. There are a couple of changes I can't write a test like when passphrase: null the line context.loadPKCS12(toBuf(pfx)); is always throw Error unsupported. I guess unencrypted pfx without passphrase is not supported in the native function but the null handling works as expected before and after this changes. |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm, could you also adjust the docs?
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
@mcollina please suggest the doc update. Shall I comment on the code and describe in this API? I think I can mention the optional options accept null value. I'm not sure how to test or patch this on v16, it should be non breaking change. Anything I can do with the failing checks? |
Sorry, something went wrong.
|
I don't think we need a doc update, the falsy values are not documented at the moment, and this is a restoration of previous behaviour we missed to have test covered. |
Sorry, something went wrong.
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/41170 ✔ Done loading data for nodejs/node/pull/41170 ----------------------------------- PR info ------------------------------------ Title tls: permit null as a pfx value (#41170) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch CallMeLaNN:fix/pfx-cant-load -> nodejs:master Labels tls, author ready Commits 2 - tls: permit null as a pfx value - tls: permit null as an options value Committers 1 - CallMeLaNN PR-URL: https://github.com/nodejs/node/pull/41170 Fixes: https://github.com/nodejs/node/issues/36292 Reviewed-By: Matteo Collina Reviewed-By: Filip Skokan ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/41170 Fixes: https://github.com/nodejs/node/issues/36292 Reviewed-By: Matteo Collina Reviewed-By: Filip Skokan -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 14 Dec 2021 13:57:39 GMT ✔ Approvals: 2 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/41170#pullrequestreview-832783699 ✔ - Filip Skokan (@panva): https://github.com/nodejs/node/pull/41170#pullrequestreview-832785694 ✔ Last GitHub Actions successful ℹ Last Full PR CI on 2021-12-16T09:05:25Z: https://ci.nodejs.org/job/node-test-pull-request/41511/ - Querying data for job/node-test-pull-request/41511/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/master up to date... From https://github.com/nodejs/node * branch master -> FETCH_HEAD ✔ origin/master is now up-to-date - Downloading patch for 41170 From https://github.com/nodejs/node * branch refs/pull/41170/merge -> FETCH_HEAD ✔ Fetched commits as a182a2163606..f474aa5f722c -------------------------------------------------------------------------------- [master 398b32f020] tls: permit null as a pfx value Author: CallMeLaNN Date: Fri Dec 10 20:52:41 2021 +0800 2 files changed, 18 insertions(+), 1 deletion(-) [master 20ba07821f] tls: permit null as an options value Author: CallMeLaNN Date: Wed Dec 15 15:01:36 2021 +0800 2 files changed, 33 insertions(+), 18 deletions(-) ✔ Patches applied There are 2 commits in the PR. Attempting autorebase. Rebasing (2/4)https://github.com/nodejs/node/actions/runs/1591586400 |
Sorry, something went wrong.
There was a problem hiding this comment.
Can we use optional chaining? It's very wordy as is.
Sorry, something went wrong.
| val !== undefined && val !== null && | ||
| val.pem !== undefined ? val.pem : val); |
There was a problem hiding this comment.
| val !== undefined && val !== null && | |
| val.pem !== undefined ? val.pem : val); | |
| val?.pem !== undefined ? val.pem : val); |
Sorry, something went wrong.
| val !== undefined && val !== null && | ||
| val.passphrase !== undefined ? val.passphrase : passphrase); |
There was a problem hiding this comment.
| val !== undefined && val !== null && | |
| val.passphrase !== undefined ? val.passphrase : passphrase); | |
| val?.passphrase !== undefined ? val.passphrase : passphrase); |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Allow null along with undefined for pfx value.
This is to avoid breaking change when upgrading v14 to v16 and
third party library passing null to https option, pfx.
Fixes: #36292