From bec1aee6048f8a3571dea9ec996cd20ad112c504 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 1 Aug 2017 16:02:49 -0700 Subject: [PATCH] http: fix basic auth options. --- lib/http/base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/http/base.js b/lib/http/base.js index f81d6a67..4797be1a 100644 --- a/lib/http/base.js +++ b/lib/http/base.js @@ -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';