diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index e738bf3b09..4e67792666 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -8500,10 +8500,9 @@ } }, "node_modules/undici": { - "version": "5.28.5", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz", - "integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==", - "license": "MIT", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", "dependencies": { "@fastify/busboy": "^2.0.0" }, diff --git a/node_modules/undici/lib/cookies/index.js b/node_modules/undici/lib/cookies/index.js index c9c1f28ee1..f867b197a0 100644 --- a/node_modules/undici/lib/cookies/index.js +++ b/node_modules/undici/lib/cookies/index.js @@ -1,7 +1,7 @@ 'use strict' const { parseSetCookie } = require('./parse') -const { stringify, getHeadersList } = require('./util') +const { stringify } = require('./util') const { webidl } = require('../fetch/webidl') const { Headers } = require('../fetch/headers') @@ -77,14 +77,13 @@ function getSetCookies (headers) { 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/node_modules/undici/lib/cookies/util.js b/node_modules/undici/lib/cookies/util.js index 2290329fe8..be3ccbeba3 100644 --- a/node_modules/undici/lib/cookies/util.js +++ b/node_modules/undici/lib/cookies/util.js @@ -1,8 +1,9 @@ 'use strict' -const assert = require('assert') -const { kHeadersList } = require('../core/symbols') - +/** + * @param {string} value + * @returns {boolean} + */ function isCTLExcludingHtab (value) { if (value.length === 0) { return false @@ -263,29 +264,11 @@ function stringify (cookie) { 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 -} - module.exports = { isCTLExcludingHtab, - stringify, - getHeadersList + validateCookieName, + validateCookiePath, + validateCookieValue, + toIMFDate, + stringify } diff --git a/node_modules/undici/lib/fetch/headers.js b/node_modules/undici/lib/fetch/headers.js index 2f1c0be5a4..fcab732961 100644 --- a/node_modules/undici/lib/fetch/headers.js +++ b/node_modules/undici/lib/fetch/headers.js @@ -10,6 +10,7 @@ const { isValidHeaderName, isValidHeaderValue } = require('./util') +const util = require('util') const { webidl } = require('./webidl') const assert = require('assert') @@ -563,6 +564,9 @@ Object.defineProperties(Headers.prototype, { [Symbol.toStringTag]: { value: 'Headers', configurable: true + }, + [util.inspect.custom]: { + enumerable: false } }) diff --git a/node_modules/undici/lib/pool.js b/node_modules/undici/lib/pool.js index e3cd3399e6..86b29d4420 100644 --- a/node_modules/undici/lib/pool.js +++ b/node_modules/undici/lib/pool.js @@ -73,6 +73,20 @@ class Pool extends PoolBase { ? { ...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] () { diff --git a/node_modules/undici/package.json b/node_modules/undici/package.json index 0c6b71e175..738688d959 100644 --- a/node_modules/undici/package.json +++ b/node_modules/undici/package.json @@ -1,6 +1,6 @@ { "name": "undici", - "version": "5.28.5", + "version": "5.29.0", "description": "An HTTP/1.1 client, written from scratch for Node.js", "homepage": "https://undici.nodejs.org", "bugs": { diff --git a/package-lock.json b/package-lock.json index 59c09e9b89..ccb3e13dd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8568,10 +8568,9 @@ } }, "node_modules/undici": { - "version": "5.28.5", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz", - "integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==", - "license": "MIT", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", "dependencies": { "@fastify/busboy": "^2.0.0" },