Skip to content

Commit d87348d

Browse files
authored
Merge pull request #567 from cloudamqp/tls-sni
set SNI hostname for TLS connections
2 parents 603c7d9 + dfa1b0e commit d87348d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/connect.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function connect(url, socketOptions, openCallback) {
106106
if (typeof url === 'object') {
107107
protocol = (url.protocol || 'amqp') + ':';
108108
sockopts.host = url.hostname;
109+
sockopts.servername = url.hostname;
109110
sockopts.port = url.port || ((protocol === 'amqp:') ? 5672 : 5671);
110111

111112
var user, pass;
@@ -130,6 +131,7 @@ function connect(url, socketOptions, openCallback) {
130131
var parts = URL(url, true); // yes, parse the query string
131132
protocol = parts.protocol;
132133
sockopts.host = parts.hostname;
134+
sockopts.servername = parts.hostname;
133135
sockopts.port = parseInt(parts.port) || ((protocol === 'amqp:') ? 5672 : 5671);
134136
var vhost = parts.pathname ? parts.pathname.substr(1) : null;
135137
fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties);

0 commit comments

Comments
 (0)