Changed the scheme check order so that the default port can default for both ldap and ldaps

This commit is contained in:
Jeff Huff 2011-08-26 15:07:10 -07:00
parent 719f379741
commit 839941d75f
1 changed files with 6 additions and 6 deletions

View File

@ -15,16 +15,16 @@ module.exports = {
if (!u.protocol || !(u.protocol === 'ldap:' || u.protocol === 'ldaps:'))
throw new TypeError(urlStr + ' is an invalid LDAP url (protocol)');
if (!u.port) {
u.port = 389;
} else {
u.port = parseInt(u.port, 10);
}
u.secure = (u.protocol === 'ldaps:');
if (!u.hostname)
u.hostname = 'localhost';
u.secure = (u.protocol === 'ldaps:');
if (!u.port) {
u.port = (u.secure ? 636 : 389);
} else {
u.port = parseInt(u.port, 10);
}
if (u.pathname) {
u.pathname = querystring.unescape(u.pathname.substr(1));