node_modules: update

This commit is contained in:
dawidd6 authored and github-actions[bot] committed 2026-10-22 19:47:05 +00:00
1 parent 67d71b1eee
commit b43b7a6aba
13 files changed
+154 -23

No files matched your search

+43 -1
View File
@@ -365,6 +365,26 @@ export function buildHeaderParam(key, data, maxLength) {
* goes in. Whitespace used to come off it only because the value was trimmed first.
*/
const TOKEN = /^[^\x00-\x20\x7f()<>@,;:\\"/[\]?=]+$/;
/**
* Offset of the ')' that closes the RFC 822 comment opening at `start`, or -1 when the
* comment never closes. Comments nest, and a backslash escapes the character after it
*/
function _findCommentEnd(str, start) {
let depth = 0;
for (let i = start, len = str.length; i < len; i++) {
const c = str.charAt(i);
if (c === '\\') {
i++;
}
else if (c === '(') {
depth++;
}
else if (c === ')' && --depth === 0) {
return i;
}
}
return -1;
}
/**
* Whether a string can be a header parameter name.
*
@@ -391,13 +411,16 @@ function _isParamName(name) {
* }
*
* @param str Header value
* @param options Options, see ParseHeaderValueOptions
* @return Header value as a parsed structure
*/
export function parseHeaderValue(str) {
export function parseHeaderValue(str, options) {
const response = {
value: '',
params: {}
};
// Cleared again by an unclosed '(', see the loop
let stripComments = !!options?.stripComments;
// A duplicated parameter resolves to its first occurrence, the way a duplicated header
// does. Letting the last one win disagrees with the receivers that take the first, and
// the two readings of 'boundary="b"; boundary="c"' name different delimiters. The
@@ -459,6 +482,25 @@ export function parseHeaderValue(str) {
};
for (let i = 0, len = str.length; i < len; i++) {
chr = str.charAt(i);
// With stripComments, an RFC 822 comment stands anywhere outside a quoted string but
// right behind a token it would continue, see ParseHeaderValueOptions. In the value
// of a parameter, no pending whitespace means the last significant character was the
// '=' or a character of the token
if (stripComments && chr === '(' && !quote && !quoteClosed && !(stage === 'value' && key !== false && !pendingSpace)) {
let end = _findCommentEnd(str, i);
if (end < 0 && str.indexOf(';', i) < 0) {
// a comment that never closes runs to the end of the value, unless a
// parameter follows it, which is content then and survives
end = len - 1;
}
if (end >= 0) {
i = end;
continue;
}
// looking for a closing ')' again would scan a run of unclosed '(' to its end
// once for each of them
stripComments = false;
}
if (stage === 'key') {
if (chr === '=') {
key = takeValue().trim();