Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ function connect(url, socketOptions, openCallback) {
fields = openFrames(url.vhost, config, sockopts.credentials || credentials.plain(user, pass), extraClientProperties);
} else {
var parts = URL(url, true); // yes, parse the query string
var host = parts.hostname.replace(/^\[|\]$/g, '');
protocol = parts.protocol;
sockopts.host = parts.hostname;
sockopts.servername = sockopts.servername || parts.hostname;
sockopts.host = host
sockopts.servername = sockopts.servername || host
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
7 changes: 7 additions & 0 deletions test/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ suite("Connect API", function() {
kCallback(succeed(done), fail(done)));
});

test("ipv6", function(done) {
connect('amqp://[::1]', {}, function(err, connection) {
if (err) { return done(err); }
done();
});
});

test("using unsupported mechanism", function(done) {
var creds = {
mechanism: 'UNSUPPORTED',
Expand Down