http: fix basic auth options.
This commit is contained in:
parent
ee7ad9dc86
commit
bec1aee604
@ -191,13 +191,13 @@ HTTPBase.prototype.basicAuth = function basicAuth(options) {
|
|||||||
assert(typeof user === 'string');
|
assert(typeof user === 'string');
|
||||||
assert(user.length <= 255, 'Username too long.');
|
assert(user.length <= 255, 'Username too long.');
|
||||||
assert(util.isAscii(user), 'Username must be ASCII.');
|
assert(util.isAscii(user), 'Username must be ASCII.');
|
||||||
user = digest.hash256(user);
|
user = digest.hash256(Buffer.from(user, 'ascii'));
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(typeof pass === 'string');
|
assert(typeof pass === 'string');
|
||||||
assert(pass.length <= 255, 'Password too long.');
|
assert(pass.length <= 255, 'Password too long.');
|
||||||
assert(util.isAscii(pass), 'Password must be ASCII.');
|
assert(util.isAscii(pass), 'Password must be ASCII.');
|
||||||
pass = digest.hash256(pass);
|
pass = digest.hash256(Buffer.from(pass, 'ascii'));
|
||||||
|
|
||||||
if (!realm)
|
if (!realm)
|
||||||
realm = 'server';
|
realm = 'server';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user