From 389a765825adabb7b0d696e8260f567bdf76871d Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 20 Oct 2022 10:21:09 +0200 Subject: [PATCH] fix(mixins/_parseBasicAuth): consider empty password as missing This makes `username:` recognized as token, just like `username` is. This fixes token-based authentication in HttpProxy with cURL. --- @xen-orchestra/mixins/_parseBasicAuth.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/@xen-orchestra/mixins/_parseBasicAuth.mjs b/@xen-orchestra/mixins/_parseBasicAuth.mjs index 91c0ca8b2..a44cee9bf 100644 --- a/@xen-orchestra/mixins/_parseBasicAuth.mjs +++ b/@xen-orchestra/mixins/_parseBasicAuth.mjs @@ -15,6 +15,8 @@ export function parseBasicAuth(header) { const i = credentials.indexOf(':') if (i === -1) { credentials = { token: credentials } + } else if (i === credentials.length - 1) { + credentials = { token: credentials.slice(0, i) } } else { // https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1 credentials = {