fix off-by-one

This commit is contained in:
James Brumond 2023-08-18 21:43:03 -07:00
parent 3c3c6ca421
commit f65905c9bd
Signed by: james
GPG Key ID: E8F2FC44BAA3357A
3 changed files with 5 additions and 13 deletions

8
dist/index.js vendored
View File

@ -3126,13 +3126,10 @@ function parse_www_authenticate(www_authenticate) {
throw new Error('invalid www-authenticate header (unclosed quotes)');
}
parameters[key] = remaining.slice(1, close_index);
remaining = remaining.slice(close_index + 1);
console.log({ key, value: parameters[key] });
parameters[key] = remaining.slice(1, close_index + 1);
remaining = remaining.slice(close_index + 2);
if (remaining && remaining[0] !== ',') {
console.log({ remaining });
throw new Error('invalid www-authenticate header (expected comma after closing quote)');
}
@ -3153,7 +3150,6 @@ function parse_www_authenticate(www_authenticate) {
}
const { realm, service, scope } = parameters;
console.log({ parameters });
if (! realm || ! service || ! scope) {
throw new Error('invalid www-authenticate header (missing "realm", "service", or "scope")');

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -212,13 +212,10 @@ function parse_www_authenticate(www_authenticate) {
throw new Error('invalid www-authenticate header (unclosed quotes)');
}
parameters[key] = remaining.slice(1, close_index);
remaining = remaining.slice(close_index + 1);
console.log({ key, value: parameters[key] });
parameters[key] = remaining.slice(1, close_index + 1);
remaining = remaining.slice(close_index + 2);
if (remaining && remaining[0] !== ',') {
console.log({ remaining });
throw new Error('invalid www-authenticate header (expected comma after closing quote)');
}
@ -239,7 +236,6 @@ function parse_www_authenticate(www_authenticate) {
}
const { realm, service, scope } = parameters;
console.log({ parameters });
if (! realm || ! service || ! scope) {
throw new Error('invalid www-authenticate header (missing "realm", "service", or "scope")');