Skip to content

Commit

Permalink
fix(url parser): error when multiple hostnames used
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Lord committed Nov 20, 2017
1 parent 6096afc commit c1aa681
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/url_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ module.exports = function(url, options, callback) {
return callback(new Error('invalid schema, expected mongodb or mongodb+srv'));
}

if (result.pathname && result.pathname.match(',')) {
// Cannot use multiple hostnames
return callback(new Error('invalid uri, cannot contain multiple hostnames'));
}

if (result.protocol === 'mongodb+srv:') {
if (result.port) {
return callback(new Error('Ports not accepted with mongodb+srv'));
Expand Down

0 comments on commit c1aa681

Please sign in to comment.