Uh oh!
There was an error while loading. Please reload this page.
http: servername === false should disable SNI - #27316
Conversation
There is no way to disable SNI extension when sending a request to HTTPS server. Setting `options.servername` to a falsy value would make Node.js core override it with either hostname or ip address. This change introduces a way to disable SNI completely if this is required for user's application. Setting `options.servername` to `false` in `https.request` would disable overrides and thus disable the extension.
nodejs-github-bot
commented
Apr 19, 2019
indutny
commented
Apr 19, 2019
cc @nodejs/http @nodejs/crypto |
srl295
left a comment
There was a problem hiding this comment.
LGTM. (though I did not have this use case, it is plausible and would have simplified my testing)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
indutny
commented
Apr 20, 2019
Thank you for review everyone! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
apapirovski
left a comment
There was a problem hiding this comment.
LGTM but one nit re: documentation.
There was a problem hiding this comment.
Boolean might be slightly misleading? It's really {string | false} since setting it to true won't do what one might expect...
There was a problem hiding this comment.
Beware that false will be the only type case here and will baffle doc tools (tools/doc/type-parser.js will throw).
There was a problem hiding this comment.
That was exactly my reasoning. We might want to use null as @bnoordhuis has suggested to fix this!
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM % nits others pointed out.
Observation: I don't think you can conclude from the test that no SNI extension is sent, just that the user's code doesn't set it explicitly. Maybe add a { SNICallback: cb } to the server's options object to verify?
Question: isn't null a better value than false for the opt-out when true doesn't work?
indutny
commented
Apr 23, 2019
@bnoordhuis I think the test verifies it very well. The Is there a common practice for falsey values that we try to follow in core? In this PR's case - there are three possible types of values @vsemozhetbyt@apapirovski@srl295@lpinca@BridgeAR may I ask y'all for an opinion on the topic? |
BridgeAR
commented
Apr 23, 2019
Not that I am aware of. Using Using I can not think of any API that only accepts Thus, I personally would go with either an empty string or |
sam-github
commented
Apr 23, 2019
I agree that an empty string and/or https://tools.ietf.org/html/rfc6066#section-3 doesn't allow zero-length server names, so an empty string is not a valid value, and attempting to set one will error with SSL_R_SSL3_EXT_INVALID_SERVERNAME if a string of length zero is passed to |
593faf5 to
1abce92Compareindutny
commented
Apr 27, 2019
Alright, updated the PR to use |
nodejs-github-bot
commented
Apr 27, 2019
There is no way to disable SNI extension when sending a request to HTTPS server. Setting `options.servername` to a falsy value would make Node.js core override it with either hostname or ip address. This change introduces a way to disable SNI completely if this is required for user's application. Setting `options.servername` to `` in `https.request` would disable overrides and thus disable the extension. PR-URL: nodejs#27316 Reviewed-By: Steven R Loomis <srloomis@us.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Trott
commented
Apr 30, 2019
Landed in 98e9de7 |
There is no way to disable SNI extension when sending a request to HTTPS server. Setting `options.servername` to a falsy value would make Node.js core override it with either hostname or ip address. This change introduces a way to disable SNI completely if this is required for user's application. Setting `options.servername` to `` in `https.request` would disable overrides and thus disable the extension. PR-URL: #27316 Reviewed-By: Steven R Loomis <srloomis@us.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
There is no way to disable SNI extension when sending a request to HTTPS
server. Setting
options.servernameto a falsy value would make Node.jscore override it with either hostname or ip address.
This change introduces a way to disable SNI completely if this is
required for user's application. Setting
options.servernametofalsein
https.requestwould disable overrides and thus disable theextension.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes