diff --git a/dist/index.js b/dist/index.js index 362fd36..0900611 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11492,6 +11492,20 @@ function requirePool () { ? { ...options.interceptors } : undefined; this[kFactory] = factory; + + this.on('connectionError', (origin, targets, error) => { + // If a connection error occurs, we remove the client from the pool, + // and emit a connectionError event. They will not be re-used. + // Fixes https://github.com/nodejs/undici/issues/3895 + for (const target of targets) { + // Do not use kRemoveClient here, as it will close the client, + // but the client cannot be closed in this state. + const idx = this[kClients].indexOf(target); + if (idx !== -1) { + this[kClients].splice(idx, 1); + } + } + }); } [kGetDispatcher] () { @@ -14953,6 +14967,7 @@ function requireHeaders () { isValidHeaderName, isValidHeaderValue } = requireUtil$5(); + const util = require$$0$2; const { webidl } = requireWebidl(); const assert = require$$0$3; @@ -15499,6 +15514,9 @@ function requireHeaders () { [Symbol.toStringTag]: { value: 'Headers', configurable: true + }, + [util.inspect.custom]: { + enumerable: false } }); @@ -21388,9 +21406,10 @@ function requireUtil$1 () { if (hasRequiredUtil$1) return util$1; hasRequiredUtil$1 = 1; - const assert = require$$0$3; - const { kHeadersList } = requireSymbols$4(); - + /** + * @param {string} value + * @returns {boolean} + */ function isCTLExcludingHtab (value) { if (value.length === 0) { return false @@ -21651,31 +21670,13 @@ function requireUtil$1 () { return out.join('; ') } - let kHeadersListNode; - - function getHeadersList (headers) { - if (headers[kHeadersList]) { - return headers[kHeadersList] - } - - if (!kHeadersListNode) { - kHeadersListNode = Object.getOwnPropertySymbols(headers).find( - (symbol) => symbol.description === 'headers list' - ); - - assert(kHeadersListNode, 'Headers cannot be parsed'); - } - - const headersList = headers[kHeadersListNode]; - assert(headersList); - - return headersList - } - util$1 = { isCTLExcludingHtab, - stringify, - getHeadersList + validateCookieName, + validateCookiePath, + validateCookieValue, + toIMFDate, + stringify }; return util$1; } @@ -22013,7 +22014,7 @@ function requireCookies () { hasRequiredCookies = 1; const { parseSetCookie } = requireParse(); - const { stringify, getHeadersList } = requireUtil$1(); + const { stringify } = requireUtil$1(); const { webidl } = requireWebidl(); const { Headers } = requireHeaders(); @@ -22089,14 +22090,13 @@ function requireCookies () { webidl.brandCheck(headers, Headers, { strict: false }); - const cookies = getHeadersList(headers).cookies; + const cookies = headers.getSetCookie(); if (!cookies) { return [] } - // In older versions of undici, cookies is a list of name:value. - return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair)) + return cookies.map((pair) => parseSetCookie(pair)) } /** diff --git a/package-lock.json b/package-lock.json index 4b1f8b9..c4b25a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1897,9 +1897,9 @@ } }, "node_modules/@github/local-action/node_modules/undici": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.8.0.tgz", - "integrity": "sha512-vFv1GA99b7eKO1HG/4RPu2Is3FBTWBrmzqzO0mz+rLxN3yXkE4mqRcb8g8fHxzX4blEysrNZLqg5RbJLqX5buA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.9.0.tgz", + "integrity": "sha512-e696y354tf5cFZPXsF26Yg+5M63+5H3oE6Vtkh2oqbvsE2Oe7s2nIbcQh5lmG7Lp/eS29vJtTpw9+p6PX0qNSg==", "dev": true, "license": "MIT", "engines": { @@ -11667,9 +11667,9 @@ } }, "node_modules/undici": { - "version": "5.28.5", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz", - "integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", "license": "MIT", "dependencies": { "@fastify/busboy": "^2.0.0"