summaryrefslogtreecommitdiff
path: root/lib/_http_agent.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2019-04-19 15:51:24 -0400
committerRich Trott <rtrott@gmail.com>2019-04-30 06:43:22 -0700
commit98e9de7db930e505884ca8d0ca6588afbe43f127 (patch)
tree40c1326558a751bfd2d3fcb46f121767c86d428d /lib/_http_agent.js
parent524dd469cefb63c9963a9c7a99197df857888f1a (diff)
downloadandroid-node-v8-98e9de7db930e505884ca8d0ca6588afbe43f127.tar.gz
android-node-v8-98e9de7db930e505884ca8d0ca6588afbe43f127.tar.bz2
android-node-v8-98e9de7db930e505884ca8d0ca6588afbe43f127.zip
http: `servername === false` should disable SNI
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib/_http_agent.js')
-rw-r--r--lib/_http_agent.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/_http_agent.js b/lib/_http_agent.js
index 32dbf27abc..eb98f2b0bd 100644
--- a/lib/_http_agent.js
+++ b/lib/_http_agent.js
@@ -151,7 +151,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
if (options.socketPath)
options.path = options.socketPath;
- if (!options.servername)
+ if (!options.servername && options.servername !== '')
options.servername = calculateServerName(options, req);
const name = this.getName(options);
@@ -198,7 +198,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
if (options.socketPath)
options.path = options.socketPath;
- if (!options.servername)
+ if (!options.servername && options.servername !== '')
options.servername = calculateServerName(options, req);
const name = this.getName(options);