Skip to content

Commit 588784e

Browse files
deps: update undici to 5.25.4
PR-URL: #50025 Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent fce8fba commit 588784e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3375
-8777
lines changed

deps/undici/src/lib/compat/dispatcher-weakref.js

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ class CompatFinalizer {
3131
}
3232

3333
module.exports = function () {
34+
// FIXME: remove workaround when the Node bug is fixed
35+
// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
36+
if (process.env.NODE_V8_COVERAGE) {
37+
return {
38+
WeakRef: CompatWeakRef,
39+
FinalizationRegistry: CompatFinalizer
40+
}
41+
}
3442
return {
3543
WeakRef: global.WeakRef || CompatWeakRef,
3644
FinalizationRegistry: global.FinalizationRegistry || CompatFinalizer

deps/undici/src/lib/core/connect.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ let tls // include tls conditionally since it is not always available
1313
// re-use is enabled.
1414

1515
let SessionCache
16-
if (global.FinalizationRegistry) {
16+
// FIXME: remove workaround when the Node bug is fixed
17+
// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
18+
if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) {
1719
SessionCache = class WeakSessionCache {
1820
constructor (maxCachedSessions) {
1921
this._maxCachedSessions = maxCachedSessions

deps/undici/src/lib/core/util.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,31 @@ function parseURL (url) {
5858
throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.')
5959
}
6060

61-
if (url.port != null && url.port !== '' && !Number.isFinite(parseInt(url.port))) {
62-
throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.')
61+
if (!/^https?:/.test(url.origin || url.protocol)) {
62+
throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
6363
}
6464

65-
if (url.path != null && typeof url.path !== 'string') {
66-
throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.')
67-
}
65+
if (!(url instanceof URL)) {
66+
if (url.port != null && url.port !== '' && !Number.isFinite(parseInt(url.port))) {
67+
throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.')
68+
}
6869

69-
if (url.pathname != null && typeof url.pathname !== 'string') {
70-
throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.')
71-
}
70+
if (url.path != null && typeof url.path !== 'string') {
71+
throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.')
72+
}
7273

73-
if (url.hostname != null && typeof url.hostname !== 'string') {
74-
throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.')
75-
}
74+
if (url.pathname != null && typeof url.pathname !== 'string') {
75+
throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.')
76+
}
7677

77-
if (url.origin != null && typeof url.origin !== 'string') {
78-
throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.')
79-
}
78+
if (url.hostname != null && typeof url.hostname !== 'string') {
79+
throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.')
80+
}
8081

81-
if (!/^https?:/.test(url.origin || url.protocol)) {
82-
throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
83-
}
82+
if (url.origin != null && typeof url.origin !== 'string') {
83+
throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.')
84+
}
8485

85-
if (!(url instanceof URL)) {
8686
const port = url.port != null
8787
? url.port
8888
: (url.protocol === 'https:' ? 443 : 80)

deps/undici/src/lib/fetch/body.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const Busboy = require('busboy')
3+
const Busboy = require('@fastify/busboy')
44
const util = require('../core/util')
55
const {
66
ReadableStreamFrom,
@@ -385,10 +385,9 @@ function bodyMixinMethods (instance) {
385385
let busboy
386386

387387
try {
388-
busboy = Busboy({
388+
busboy = new Busboy({
389389
headers,
390-
preservePath: true,
391-
defParamCharset: 'utf8'
390+
preservePath: true
392391
})
393392
} catch (err) {
394393
throw new DOMException(`${err}`, 'AbortError')
@@ -397,8 +396,7 @@ function bodyMixinMethods (instance) {
397396
busboy.on('field', (name, value) => {
398397
responseFormData.append(name, value)
399398
})
400-
busboy.on('file', (name, value, info) => {
401-
const { filename, encoding, mimeType } = info
399+
busboy.on('file', (name, value, filename, encoding, mimeType) => {
402400
const chunks = []
403401

404402
if (encoding === 'base64' || encoding.toLowerCase() === 'base64') {

deps/undici/src/lib/fetch/global.js

-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ function getGlobalOrigin () {
99
}
1010

1111
function setGlobalOrigin (newOrigin) {
12-
if (
13-
newOrigin !== undefined &&
14-
typeof newOrigin !== 'string' &&
15-
!(newOrigin instanceof URL)
16-
) {
17-
throw new Error('Invalid base url')
18-
}
19-
2012
if (newOrigin === undefined) {
2113
Object.defineProperty(globalThis, globalOrigin, {
2214
value: undefined,

deps/undici/src/node_modules/@fastify/busboy/README.md

+271
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)