From dfa1b0e6fdb025e593e4f7d8ca3b51009a7b5c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Ho=CC=88rberg?= Date: Tue, 31 Mar 2020 15:49:19 +0200 Subject: [PATCH] set SNI hostname for TLS connections --- lib/connect.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/connect.js b/lib/connect.js index 603f1981..27a042ec 100644 --- a/lib/connect.js +++ b/lib/connect.js @@ -106,6 +106,7 @@ function connect(url, socketOptions, openCallback) { if (typeof url === 'object') { protocol = (url.protocol || 'amqp') + ':'; sockopts.host = url.hostname; + sockopts.servername = url.hostname; sockopts.port = url.port || ((protocol === 'amqp:') ? 5672 : 5671); var user, pass; @@ -130,6 +131,7 @@ function connect(url, socketOptions, openCallback) { var parts = URL(url, true); // yes, parse the query string protocol = parts.protocol; sockopts.host = parts.hostname; + sockopts.servername = parts.hostname; sockopts.port = parseInt(parts.port) || ((protocol === 'amqp:') ? 5672 : 5671); var vhost = parts.pathname ? parts.pathname.substr(1) : null; fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties);