Skip to content

Commit 784ba9c

Browse files
aduh95github-actions[bot]
authored andcommitted
deps: update undici to 6.25.0
1 parent 5f9bb8e commit 784ba9c

16 files changed

Lines changed: 260 additions & 135 deletions

File tree

deps/undici/src/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,9 @@ undici-fetch.js
8787

8888
# File generated by /test/request-timeout.js
8989
test/request-timeout.10mb.bin
90+
91+
# Local agent configuration
92+
CLAUDE.md
93+
AGENTS.md
94+
.pi/
95+
.claude/

deps/undici/src/docs/docs/api/Client.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Returns: `Client`
2626
* **keepAliveTimeoutThreshold** `number | null` (optional) - Default: `2e3` - A number of milliseconds subtracted from server *keep-alive* hints when overriding `keepAliveTimeout` to account for timing inaccuracies caused by e.g. transport latency. Defaults to 2 seconds.
2727
* **maxHeaderSize** `number | null` (optional) - Default: `--max-http-header-size` or `16384` - The maximum length of request headers in bytes. Defaults to Node.js' --max-http-header-size or 16KiB.
2828
* **maxResponseSize** `number | null` (optional) - Default: `-1` - The maximum length of response body in bytes. Set to `-1` to disable.
29+
* **webSocket** `WebSocketOptions` (optional) - WebSocket-specific configuration options.
30+
* **maxPayloadSize** `number` (optional) - Default: `134217728` (128 MB) - Maximum allowed payload size in bytes for WebSocket messages. Applied to uncompressed messages, compressed frame payloads, and decompressed (permessage-deflate) messages. Set to 0 to disable the limit.
2931
* **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
3032
* **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
3133
* **strictContentLength** `Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body.

deps/undici/src/lib/dispatcher/agent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function defaultFactory (origin, opts) {
2424

2525
class Agent extends DispatcherBase {
2626
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
27-
super()
2827

2928
if (typeof factory !== 'function') {
3029
throw new InvalidArgumentError('factory must be a function.')
@@ -38,6 +37,8 @@ class Agent extends DispatcherBase {
3837
throw new InvalidArgumentError('maxRedirections must be a positive number')
3938
}
4039

40+
super(options)
41+
4142
if (connect && typeof connect !== 'function') {
4243
connect = { ...connect }
4344
}

deps/undici/src/lib/dispatcher/client.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ class Client extends DispatcherBase {
106106
autoSelectFamilyAttemptTimeout,
107107
// h2
108108
maxConcurrentStreams,
109-
allowH2
109+
allowH2,
110+
webSocket
110111
} = {}) {
111-
super()
112+
super({ webSocket })
112113

113114
if (keepAlive !== undefined) {
114115
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')

deps/undici/src/lib/dispatcher/dispatcher-base.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,23 @@ const { kDestroy, kClose, kClosed, kDestroyed, kDispatch, kInterceptors } = requ
1111
const kOnDestroyed = Symbol('onDestroyed')
1212
const kOnClosed = Symbol('onClosed')
1313
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
14+
const kWebSocketOptions = Symbol('webSocketOptions')
1415

1516
class DispatcherBase extends Dispatcher {
16-
constructor () {
17+
constructor (opts) {
1718
super()
1819

1920
this[kDestroyed] = false
2021
this[kOnDestroyed] = null
2122
this[kClosed] = false
2223
this[kOnClosed] = []
24+
this[kWebSocketOptions] = opts?.webSocket ?? {}
25+
}
26+
27+
get webSocketOptions () {
28+
return {
29+
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
30+
}
2331
}
2432

2533
get destroyed () {

deps/undici/src/lib/dispatcher/pool-base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const kRemoveClient = Symbol('remove client')
1919
const kStats = Symbol('stats')
2020

2121
class PoolBase extends DispatcherBase {
22-
constructor () {
23-
super()
22+
constructor (opts) {
23+
super(opts)
2424

2525
this[kQueue] = new FixedQueue()
2626
this[kClients] = []

deps/undici/src/lib/dispatcher/pool.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class Pool extends PoolBase {
3737
allowH2,
3838
...options
3939
} = {}) {
40-
super()
41-
4240
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
4341
throw new InvalidArgumentError('invalid connections')
4442
}
@@ -63,6 +61,8 @@ class Pool extends PoolBase {
6361
})
6462
}
6563

64+
super(options)
65+
6666
this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
6767
? options.interceptors.Pool
6868
: []

deps/undici/src/lib/llhttp/wasm_build_env.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
2-
> undici@6.24.1 prebuild:wasm
3-
> node build/wasm.js --prebuild
4-
5-
> docker build --platform=linux/x86_64 -t llhttp_wasm_builder -f /home/runner/work/node/node/deps/undici/src/build/Dockerfile /home/runner/work/node/node/deps/undici/src
6-
7-
8-
9-
> undici@6.24.1 build:wasm
10-
> node build/wasm.js --docker
11-
12-
> docker run --rm -t --platform=linux/x86_64 --user 1000:1000 --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/lib/llhttp,target=/home/node/undici/lib/llhttp llhttp_wasm_builder node build/wasm.js
13-
14-
1+
2+
> undici@6.25.0 prebuild:wasm
3+
> node build/wasm.js --prebuild
4+
5+
> docker build --platform=linux/x86_64 -t llhttp_wasm_builder -f /home/runner/work/node/node/deps/undici/src/build/Dockerfile /home/runner/work/node/node/deps/undici/src
6+
7+
8+
9+
> undici@6.25.0 build:wasm
10+
> node build/wasm.js --docker
11+
12+
> docker run --rm -t --platform=linux/x86_64 --user 1001:1001 --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/lib/llhttp,target=/home/node/undici/lib/llhttp llhttp_wasm_builder node build/wasm.js
13+
14+
1515
alpine-baselayout-3.4.3-r2
1616
alpine-baselayout-data-3.4.3-r2
1717
alpine-keys-2.4-r1
@@ -44,8 +44,8 @@ llvm17-libs-17.0.5-r0
4444
llvm17-linker-tools-17.0.5-r0
4545
mpc1-1.3.1-r1
4646
mpfr4-4.2.1-r0
47-
musl-1.2.4_git20230717-r5
48-
musl-dev-1.2.4_git20230717-r5
47+
musl-1.2.4_git20230717-r6
48+
musl-dev-1.2.4_git20230717-r6
4949
musl-utils-1.2.4_git20230717-r4
5050
scanelf-1.3.7-r2
5151
scudo-malloc-17.0.5-r0

deps/undici/src/lib/web/websocket/permessage-deflate.js

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,35 @@ const tail = Buffer.from([0x00, 0x00, 0xff, 0xff])
88
const kBuffer = Symbol('kBuffer')
99
const kLength = Symbol('kLength')
1010

11-
// Default maximum decompressed message size: 4 MB
12-
const kDefaultMaxDecompressedSize = 4 * 1024 * 1024
13-
1411
class PerMessageDeflate {
1512
/** @type {import('node:zlib').InflateRaw} */
1613
#inflate
1714

1815
#options = {}
1916

20-
/** @type {boolean} */
21-
#aborted = false
22-
23-
/** @type {Function|null} */
24-
#currentCallback = null
17+
#maxPayloadSize = 0
2518

2619
/**
2720
* @param {Map<string, string>} extensions
2821
*/
29-
constructor (extensions) {
22+
constructor (extensions, options) {
3023
this.#options.serverNoContextTakeover = extensions.has('server_no_context_takeover')
3124
this.#options.serverMaxWindowBits = extensions.get('server_max_window_bits')
25+
26+
this.#maxPayloadSize = options.maxPayloadSize
3227
}
3328

29+
/**
30+
* Decompress a compressed payload.
31+
* @param {Buffer} chunk Compressed data
32+
* @param {boolean} fin Final fragment flag
33+
* @param {Function} callback Callback function
34+
*/
3435
decompress (chunk, fin, callback) {
3536
// An endpoint uses the following algorithm to decompress a message.
3637
// 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the
3738
// payload of the message.
3839
// 2. Decompress the resulting data using DEFLATE.
39-
40-
if (this.#aborted) {
41-
callback(new MessageSizeExceededError())
42-
return
43-
}
44-
4540
if (!this.#inflate) {
4641
let windowBits = Z_DEFAULT_WINDOWBITS
4742

@@ -64,23 +59,12 @@ class PerMessageDeflate {
6459
this.#inflate[kLength] = 0
6560

6661
this.#inflate.on('data', (data) => {
67-
if (this.#aborted) {
68-
return
69-
}
70-
7162
this.#inflate[kLength] += data.length
7263

73-
if (this.#inflate[kLength] > kDefaultMaxDecompressedSize) {
74-
this.#aborted = true
64+
if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
65+
callback(new MessageSizeExceededError())
7566
this.#inflate.removeAllListeners()
76-
this.#inflate.destroy()
7767
this.#inflate = null
78-
79-
if (this.#currentCallback) {
80-
const cb = this.#currentCallback
81-
this.#currentCallback = null
82-
cb(new MessageSizeExceededError())
83-
}
8468
return
8569
}
8670

@@ -93,22 +77,20 @@ class PerMessageDeflate {
9377
})
9478
}
9579

96-
this.#currentCallback = callback
9780
this.#inflate.write(chunk)
9881
if (fin) {
9982
this.#inflate.write(tail)
10083
}
10184

10285
this.#inflate.flush(() => {
103-
if (this.#aborted || !this.#inflate) {
86+
if (!this.#inflate) {
10487
return
10588
}
10689

10790
const full = Buffer.concat(this.#inflate[kBuffer], this.#inflate[kLength])
10891

10992
this.#inflate[kBuffer].length = 0
11093
this.#inflate[kLength] = 0
111-
this.#currentCallback = null
11294

11395
callback(null, full)
11496
})

0 commit comments

Comments
 (0)