http: fix basic auth options.

This commit is contained in:
Christopher Jeffrey 2017-08-01 16:02:49 -07:00
parent ee7ad9dc86
commit bec1aee604
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -191,13 +191,13 @@ HTTPBase.prototype.basicAuth = function basicAuth(options) {
assert(typeof user === 'string');
assert(user.length <= 255, 'Username too long.');
assert(util.isAscii(user), 'Username must be ASCII.');
user = digest.hash256(user);
user = digest.hash256(Buffer.from(user, 'ascii'));
}
assert(typeof pass === 'string');
assert(pass.length <= 255, 'Password too long.');
assert(util.isAscii(pass), 'Password must be ASCII.');
pass = digest.hash256(pass);
pass = digest.hash256(Buffer.from(pass, 'ascii'));
if (!realm)
realm = 'server';