node_modules: update (#344)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-10 17:27:57 +02:00
1 parent b099186883
commit 6e88c72525
63 files changed
+2863 -1227

No files matched your search

+18 -11
View File
@@ -130,19 +130,31 @@ class Cookies {
*/
parse(cookieStr) {
const cookie = {};
let hasNameValue = false;
(cookieStr || '')
.toString()
.split(';')
.forEach(cookiePart => {
const valueParts = cookiePart.split('=');
const key = valueParts.shift().trim().toLowerCase();
let value = valueParts.join('=').trim();
let domain;
if (!key) {
if (!cookiePart.trim()) {
// skip empty parts
return;
}
switch (key) {
const valueParts = cookiePart.split('=');
const name = valueParts.shift().trim();
let value = valueParts.join('=').trim();
let domain;
// the first part is always the name-value pair, so a cookie named
// like an attribute is not mistaken for one (RFC 6265 section 5.2)
if (!hasNameValue) {
hasNameValue = true;
if (name) {
// cookie names are case-sensitive, only attribute names are not
cookie.name = name;
cookie.value = value;
}
return;
}
switch (name.toLowerCase()) {
case 'expires': {
const expires = new Date(value);
// ignore date if can not parse it
@@ -170,11 +182,6 @@ class Cookies {
case 'httponly':
cookie.httponly = true;
break;
default:
if (!cookie.name) {
cookie.name = key;
cookie.value = value;
}
}
});
return cookie;
+23 -3
View File
@@ -81,6 +81,17 @@ const TLS_OPTION_KEYS = [
'sessionIdContext',
'sigalgs'
];
/**
* Marks an error of the request as a fetch error, unless it is a permission model
* denial, which keeps its own code (see ERR_ACCESS_DENIED)
*
* @param err Error to mark
*/
function setFetchCode(err) {
if (err.code !== errors.ERR_ACCESS_DENIED) {
err.code = errors.EFETCH;
}
}
/**
* Resolves a URL only if it is one this module is willing to request.
*
@@ -177,7 +188,7 @@ function nmfetch(url, options) {
return;
}
finished = true;
err.code = errors.EFETCH;
setFetchCode(err);
err.sourceUrl = url;
fetchRes.emit('error', err);
});
@@ -250,7 +261,7 @@ function nmfetch(url, options) {
catch (E) {
finished = true;
setImmediate(() => {
E.code = errors.EFETCH;
setFetchCode(E);
E.sourceUrl = url;
fetchRes.emit('error', E);
});
@@ -262,7 +273,7 @@ function nmfetch(url, options) {
return;
}
finished = true;
err.code = errors.EFETCH;
setFetchCode(err);
err.sourceUrl = sourceUrl;
fetchRes.emit('error', err);
req.abort();
@@ -272,6 +283,15 @@ function nmfetch(url, options) {
req.setTimeout(timeout, () => fail(new Error('Request Timeout')));
}
req.on('error', (err) => fail(err));
// a consumer that destroys the response stream before it ended does not want the rest of
// the body, release the request now instead of when the timeout fires
fetchRes.once('close', () => {
if (finished || fetchRes.readableEnded) {
return;
}
finished = true;
req.destroy();
});
req.on('response', res => {
let inflate;
if (finished) {