Skip to content

Commit

Permalink
Allow servername to be specified via socket options
Browse files Browse the repository at this point in the history
  • Loading branch information
cressie176 committed Jul 26, 2022
1 parent fd93de3 commit 318a682
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Change log for amqplib

## Chagnes in v0.10.0
## Changes in v0.10.1

git log v0.9.1..v0.10.0

* Allow servername to be specified via socket options as discussed in as discussed in
[issue 697](https://github.com/squaremo/amqp.node/issues/697)

## Changes in v0.10.0

git log v0.9.1..v0.10.0

* Use Native promises ([PR
689](https://github.com/amqp-node/amqplib/pull/689), thank you
@mohd-akram and @kibertoad)
Expand Down
4 changes: 2 additions & 2 deletions lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function connect(url, socketOptions, openCallback) {
if (typeof url === 'object') {
protocol = (url.protocol || 'amqp') + ':';
sockopts.host = url.hostname;
sockopts.servername = url.hostname;
sockopts.servername = sockopts.servername || url.hostname;
sockopts.port = url.port || ((protocol === 'amqp:') ? 5672 : 5671);

var user, pass;
Expand All @@ -131,7 +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.servername = 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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 318a682

Please sign in to comment.