From 574985cec8d96ee33be957f247941ad2c9e522bf Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Sun, 2 Jun 2019 18:11:48 +0200 Subject: https: do not automatically use invalid servername Stop automatically setting servername in https.request() if the target host is specified with an IP address. Doing so is invalid, and triggers a deprecation warning. It is still possible to send an IP address as a servername if its required, but it needs to be explicity configured, it won't happen automatically. PR-URL: https://github.com/nodejs/node/pull/28209 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Yongsheng Zhang Reviewed-By: Rich Trott Reviewed-By: Ruben Bridgewater --- lib/_http_agent.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/_http_agent.js') diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 12f8529c38..e1cfa6d7fc 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -256,6 +256,9 @@ function calculateServerName(options, req) { servername = hostHeader.split(':', 1)[0]; } } + // Don't implicitly set invalid (IP) servernames. + if (net.isIP(servername)) + servername = ''; return servername; } -- cgit v1.2.3