Skip to content

Commit

Permalink
Merge pull request #567 from cloudamqp/tls-sni
Browse files Browse the repository at this point in the history
set SNI hostname for TLS connections
  • Loading branch information
squaremo authored May 18, 2021
2 parents 603c7d9 + dfa1b0e commit d87348d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit d87348d

Please sign in to comment.