diff --git a/doc/api/https.md b/doc/api/https.md index 98a62e7efc1a70..9b6ec83a6e7796 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -29,9 +29,9 @@ An [`Agent`][] object for HTTPS similar to [`http.Agent`][]. See Can have the same fields as for [`http.Agent(options)`][], and * `maxCachedSessions` {number} maximum number of TLS cached sessions. Use `0` to disable TLS session caching. **Default:** `100`. - * `servername` {string | boolean} the value of + * `servername` {string} the value of [Server Name Indication extension][sni wiki] to be sent to the server. Use - `false` to disable sending the extension. + empty string `''` to disable sending the extension. **Default:** hostname or IP address of the target server. See [`Session Resumption`][] for infomation about TLS session reuse. diff --git a/lib/_http_agent.js b/lib/_http_agent.js index ae0f221e11c823..eb98f2b0bd1ca4 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 && options.servername !== false) + 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 && options.servername !== false) + if (!options.servername && options.servername !== '') options.servername = calculateServerName(options, req); const name = this.getName(options); diff --git a/test/parallel/test-https-agent-sni.js b/test/parallel/test-https-agent-sni.js index e11cd6651d644e..1ddeff7ce205d9 100644 --- a/test/parallel/test-https-agent-sni.js +++ b/test/parallel/test-https-agent-sni.js @@ -56,7 +56,7 @@ server.listen(0, function() { path: '/', port: this.address().port, host: '127.0.0.1', - servername: false, + servername: '', rejectUnauthorized: false }, expectResponse(false)); });