Skip to content

Commit bdddc12

Browse files
nodejs-github-botmarco-ippolito
authored andcommitted
deps: update undici to 6.10.2
PR-URL: #52227 Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 3ef8951 commit bdddc12

File tree

145 files changed

+14879
-23371
lines changed

Some content is hidden

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

145 files changed

+14879
-23371
lines changed

β€Ždeps/undici/src/README.md

+49-27
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,42 @@ npm i undici
1717

1818
## Benchmarks
1919

20-
The benchmark is a simple `hello world` [example](benchmarks/benchmark.js) using a
20+
The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using a
2121
50 TCP connections with a pipelining depth of 10 running on Node 20.10.0.
2222

23-
```
24-
β”‚ Tests β”‚ Samples β”‚ Result β”‚ Tolerance β”‚ Difference with slowest β”‚
25-
|─────────────────────|─────────|─────────────────|───────────|─────────────────────────|
26-
β”‚ got β”‚ 45 β”‚ 1661.71 req/sec β”‚ Β± 2.93 % β”‚ - β”‚
27-
β”‚ node-fetch β”‚ 20 β”‚ 2164.81 req/sec β”‚ Β± 2.63 % β”‚ + 30.28 % β”‚
28-
β”‚ undici - fetch β”‚ 35 β”‚ 2274.27 req/sec β”‚ Β± 2.70 % β”‚ + 36.86 % β”‚
29-
β”‚ http - no keepalive β”‚ 15 β”‚ 2376.04 req/sec β”‚ Β± 2.99 % β”‚ + 42.99 % β”‚
30-
β”‚ axios β”‚ 25 β”‚ 2612.93 req/sec β”‚ Β± 2.89 % β”‚ + 57.24 % β”‚
31-
β”‚ request β”‚ 40 β”‚ 2712.19 req/sec β”‚ Β± 2.92 % β”‚ + 63.22 % β”‚
32-
β”‚ http - keepalive β”‚ 45 β”‚ 4393.25 req/sec β”‚ Β± 2.86 % β”‚ + 164.38 % β”‚
33-
β”‚ undici - pipeline β”‚ 45 β”‚ 5484.69 req/sec β”‚ Β± 2.87 % β”‚ + 230.06 % β”‚
34-
β”‚ undici - request β”‚ 55 β”‚ 7773.98 req/sec β”‚ Β± 2.93 % β”‚ + 367.83 % β”‚
35-
β”‚ undici - stream β”‚ 70 β”‚ 8425.96 req/sec β”‚ Β± 2.91 % β”‚ + 407.07 % β”‚
36-
β”‚ undici - dispatch β”‚ 50 β”‚ 9488.99 req/sec β”‚ Β± 2.85 % β”‚ + 471.04 % β”‚
37-
```
23+
| _Tests_ | _Samples_ | _Result_ | _Tolerance_ | _Difference with slowest_ |
24+
| :-----------------: | :-------: | :--------------: | :---------: | :-----------------------: |
25+
| undici - fetch | 30 | 3704.43 req/sec | Β± 2.95 % | - |
26+
| http - no keepalive | 20 | 4275.30 req/sec | Β± 2.60 % | + 15.41 % |
27+
| node-fetch | 10 | 4759.42 req/sec | Β± 0.87 % | + 28.48 % |
28+
| request | 40 | 4803.37 req/sec | Β± 2.77 % | + 29.67 % |
29+
| axios | 45 | 4951.97 req/sec | Β± 2.88 % | + 33.68 % |
30+
| got | 10 | 5969.67 req/sec | Β± 2.64 % | + 61.15 % |
31+
| superagent | 10 | 9471.48 req/sec | Β± 1.50 % | + 155.68 % |
32+
| http - keepalive | 25 | 10327.49 req/sec | Β± 2.95 % | + 178.79 % |
33+
| undici - pipeline | 10 | 15053.41 req/sec | Β± 1.63 % | + 306.36 % |
34+
| undici - request | 10 | 19264.24 req/sec | Β± 1.74 % | + 420.03 % |
35+
| undici - stream | 15 | 20317.29 req/sec | Β± 2.13 % | + 448.46 % |
36+
| undici - dispatch | 10 | 24883.28 req/sec | Β± 1.54 % | + 571.72 % |
37+
38+
The benchmark is a simple sending data [example](https://github.com/nodejs/undici/blob/main/benchmarks/post-benchmark.js) using a
39+
50 TCP connections with a pipelining depth of 10 running on Node 20.10.0.
40+
41+
| _Tests_ | _Samples_ | _Result_ | _Tolerance_ | _Difference with slowest_ |
42+
| :-----------------: | :-------: | :-------------: | :---------: | :-----------------------: |
43+
| undici - fetch | 20 | 1968.42 req/sec | Β± 2.63 % | - |
44+
| http - no keepalive | 25 | 2330.30 req/sec | Β± 2.99 % | + 18.38 % |
45+
| node-fetch | 20 | 2485.36 req/sec | Β± 2.70 % | + 26.26 % |
46+
| got | 15 | 2787.68 req/sec | Β± 2.56 % | + 41.62 % |
47+
| request | 30 | 2805.10 req/sec | Β± 2.59 % | + 42.50 % |
48+
| axios | 10 | 3040.45 req/sec | Β± 1.72 % | + 54.46 % |
49+
| superagent | 20 | 3358.29 req/sec | Β± 2.51 % | + 70.61 % |
50+
| http - keepalive | 20 | 3477.94 req/sec | Β± 2.51 % | + 76.69 % |
51+
| undici - pipeline | 25 | 3812.61 req/sec | Β± 2.80 % | + 93.69 % |
52+
| undici - request | 10 | 6067.00 req/sec | Β± 0.94 % | + 208.22 % |
53+
| undici - stream | 10 | 6391.61 req/sec | Β± 1.98 % | + 224.71 % |
54+
| undici - dispatch | 10 | 6397.00 req/sec | Β± 1.48 % | + 224.98 % |
55+
3856

3957
## Quick Start
4058

@@ -60,10 +78,14 @@ console.log('trailers', trailers)
6078

6179
The `body` mixins are the most common way to format the request/response body. Mixins include:
6280

63-
- [`.formData()`](https://fetch.spec.whatwg.org/#dom-body-formdata)
81+
- [`.arrayBuffer()`](https://fetch.spec.whatwg.org/#dom-body-arraybuffer)
82+
- [`.blob()`](https://fetch.spec.whatwg.org/#dom-body-blob)
6483
- [`.json()`](https://fetch.spec.whatwg.org/#dom-body-json)
6584
- [`.text()`](https://fetch.spec.whatwg.org/#dom-body-text)
6685

86+
> [!NOTE]
87+
> The body returned from `undici.request` does not implement `.formData()`.
88+
6789
Example usage:
6890

6991
```js
@@ -123,14 +145,14 @@ Returns a promise with the result of the `Dispatcher.stream` method.
123145

124146
Calls `options.dispatcher.stream(options, factory)`.
125147

126-
See [Dispatcher.stream](docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback) for more details.
148+
See [Dispatcher.stream](./docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback) for more details.
127149

128150
### `undici.pipeline([url, options, ]handler): Duplex`
129151

130152
Arguments:
131153

132154
* **url** `string | URL | UrlObject`
133-
* **options** [`PipelineOptions`](docs/api/Dispatcher.md#parameter-pipelineoptions)
155+
* **options** [`PipelineOptions`](./docs/api/Dispatcher.md#parameter-pipelineoptions)
134156
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
135157
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
136158
* **maxRedirections** `Integer` - Default: `0`
@@ -140,7 +162,7 @@ Returns: `stream.Duplex`
140162

141163
Calls `options.dispatch.pipeline(options, handler)`.
142164

143-
See [Dispatcher.pipeline](docs/api/Dispatcher.md#dispatcherpipelineoptions-handler) for more details.
165+
See [Dispatcher.pipeline](./docs/api/Dispatcher.md#dispatcherpipelineoptions-handler) for more details.
144166

145167
### `undici.connect([url, options]): Promise`
146168

@@ -149,7 +171,7 @@ Starts two-way communications with the requested resource using [HTTP CONNECT](h
149171
Arguments:
150172

151173
* **url** `string | URL | UrlObject`
152-
* **options** [`ConnectOptions`](docs/api/Dispatcher.md#parameter-connectoptions)
174+
* **options** [`ConnectOptions`](./docs/api/Dispatcher.md#parameter-connectoptions)
153175
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
154176
* **maxRedirections** `Integer` - Default: `0`
155177
* **callback** `(err: Error | null, data: ConnectData | null) => void` (optional)
@@ -158,7 +180,7 @@ Returns a promise with the result of the `Dispatcher.connect` method.
158180

159181
Calls `options.dispatch.connect(options)`.
160182

161-
See [Dispatcher.connect](docs/api/Dispatcher.md#dispatcherconnectoptions-callback) for more details.
183+
See [Dispatcher.connect](./docs/api/Dispatcher.md#dispatcherconnectoptions-callback) for more details.
162184

163185
### `undici.fetch(input[, init]): Promise`
164186

@@ -226,7 +248,7 @@ await fetch('https://example.com', { body: data, method: 'POST', duplex: 'half'
226248

227249
- half
228250

229-
In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`. And fetch requests are currently always be full duplex. More detail refer to [Fetch Standard.](https://fetch.spec.whatwg.org/#dom-requestinit-duplex)
251+
In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`, however, fetch requests are currently always full duplex. For more detail refer to the [Fetch Standard.](https://fetch.spec.whatwg.org/#dom-requestinit-duplex).
230252

231253
#### `response.body`
232254

@@ -297,7 +319,7 @@ Upgrade to a different protocol. See [MDN - HTTP - Protocol upgrade mechanism](h
297319
Arguments:
298320

299321
* **url** `string | URL | UrlObject`
300-
* **options** [`UpgradeOptions`](docs/api/Dispatcher.md#parameter-upgradeoptions)
322+
* **options** [`UpgradeOptions`](./docs/api/Dispatcher.md#parameter-upgradeoptions)
301323
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
302324
* **maxRedirections** `Integer` - Default: `0`
303325
* **callback** `(error: Error | null, data: UpgradeData) => void` (optional)
@@ -306,7 +328,7 @@ Returns a promise with the result of the `Dispatcher.upgrade` method.
306328

307329
Calls `options.dispatcher.upgrade(options)`.
308330

309-
See [Dispatcher.upgrade](docs/api/Dispatcher.md#dispatcherupgradeoptions-callback) for more details.
331+
See [Dispatcher.upgrade](./docs/api/Dispatcher.md#dispatcherupgradeoptions-callback) for more details.
310332

311333
### `undici.setGlobalDispatcher(dispatcher)`
312334

@@ -400,9 +422,9 @@ Refs: https://fetch.spec.whatwg.org/#atomic-http-redirect-handling
400422

401423
If you experience problem when connecting to a remote server that is resolved by your DNS servers to a IPv6 (AAAA record)
402424
first, there are chances that your local router or ISP might have problem connecting to IPv6 networks. In that case
403-
undici will throw an error with code `UND_ERR_CONNECT_TIMEOUT`.
425+
undici will throw an error with code `UND_ERR_CONNECT_TIMEOUT`.
404426

405-
If the target server resolves to both a IPv6 and IPv4 (A records) address and you are using a compatible Node version
427+
If the target server resolves to both a IPv6 and IPv4 (A records) address and you are using a compatible Node version
406428
(18.3.0 and above), you can fix the problem by providing the `autoSelectFamily` option (support by both `undici.request`
407429
and `undici.Agent`) which will enable the family autoselection algorithm when establishing the connection.
408430

β€Ždeps/undici/src/docs/api/Fetch.md

-27
This file was deleted.
Binary file not shown.
File renamed without changes.

β€Ždeps/undici/src/docs/api/Client.md β€Ždeps/undici/src/docs/docs/api/Client.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Returns: `Client`
2929
* **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.
3030
* **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
3131
* **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.
32-
* **interceptors** `{ Client: DispatchInterceptor[] }` - Default: `[RedirectInterceptor]` - A list of interceptors that are applied to the dispatch method. Additional logic can be applied (such as, but not limited to: 302 status code handling, authentication, cookies, compression and caching). Note that the behavior of interceptors is Experimental and might change at any given time.
32+
<!-- TODO: Remove once we drop its support -->
33+
* **interceptors** `{ Client: DispatchInterceptor[] }` - Default: `[RedirectInterceptor]` - A list of interceptors that are applied to the dispatch method. Additional logic can be applied (such as, but not limited to: 302 status code handling, authentication, cookies, compression and caching). Note that the behavior of interceptors is Experimental and might change at any given time. **Note: this is deprecated in favor of [Dispatcher#compose](./Dispatcher.md#dispatcher). Support will be droped in next major.**
3334
* **autoSelectFamily**: `boolean` (optional) - Default: depends on local Node version, on Node 18.13.0 and above is `false`. Enables a family autodetection algorithm that loosely implements section 5 of [RFC 8305](https://tools.ietf.org/html/rfc8305#section-5). See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details. This option is ignored if not supported by the current Node version.
3435
* **autoSelectFamilyAttemptTimeout**: `number` - Default: depends on local Node version, on Node 18.13.0 and above is `250`. The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details.
3536
* **allowH2**: `boolean` - Default: `false`. Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
File renamed without changes.

β€Ždeps/undici/src/docs/api/DiagnosticsChannel.md β€Ždeps/undici/src/docs/docs/api/DiagnosticsChannel.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ diagnosticsChannel.channel('undici:request:create').subscribe(({ request }) => {
1919
console.log('completed', request.completed)
2020
console.log('method', request.method)
2121
console.log('path', request.path)
22-
console.log('headers') // raw text, e.g: 'bar: bar\r\n'
22+
console.log('headers') // array of strings, e.g: ['foo', 'bar']
2323
request.addHeader('hello', 'world')
24-
console.log('headers', request.headers) // e.g. 'bar: bar\r\nhello: world\r\n'
24+
console.log('headers', request.headers) // e.g. ['foo', 'bar', 'hello', 'world']
2525
})
2626
```
2727

0 commit comments

Comments
Β (0)