Skip to content

Commit 3b715d3

Browse files
deps: update undici to 7.13.0
PR-URL: #59338 Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 4f5d11e commit 3b715d3

28 files changed

+1920
-360
lines changed

deps/undici/src/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,14 @@ This behavior is intentional for server-side environments where CORS restriction
440440
* https://fetch.spec.whatwg.org/#garbage-collection
441441

442442
The [Fetch Standard](https://fetch.spec.whatwg.org) allows users to skip consuming the response body by relying on
443-
[garbage collection](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management#garbage_collection) to release connection resources. Undici does not do the same. Therefore, it is important to always either consume or cancel the response body.
443+
[garbage collection](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management#garbage_collection) to release connection resources.
444444

445445
Garbage collection in Node is less aggressive and deterministic
446446
(due to the lack of clear idle periods that browsers have through the rendering refresh rate)
447447
which means that leaving the release of connection resources to the garbage collector can lead
448448
to excessive connection usage, reduced performance (due to less connection re-use), and even
449449
stalls or deadlocks when running out of connections.
450+
Therefore, __it is important to always either consume or cancel the response body anyway__.
450451

451452
```js
452453
// Do
@@ -459,7 +460,15 @@ for await (const chunk of body) {
459460
const { headers } = await fetch(url);
460461
```
461462

462-
The same applies for `request` too:
463+
However, if you want to get only headers, it might be better to use `HEAD` request method. Usage of this method will obviate the need for consumption or cancelling of the response body. See [MDN - HTTP - HTTP request methods - HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) for more details.
464+
465+
```js
466+
const headers = await fetch(url, { method: 'HEAD' })
467+
.then(res => res.headers)
468+
```
469+
470+
Note that consuming the response body is _mandatory_ for `request`:
471+
463472
```js
464473
// Do
465474
const { body, headers } = await request(url);
@@ -469,13 +478,6 @@ await res.body.dump(); // force consumption of body
469478
const { headers } = await request(url);
470479
```
471480

472-
However, if you want to get only headers, it might be better to use `HEAD` request method. Usage of this method will obviate the need for consumption or cancelling of the response body. See [MDN - HTTP - HTTP request methods - HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) for more details.
473-
474-
```js
475-
const headers = await fetch(url, { method: 'HEAD' })
476-
.then(res => res.headers)
477-
```
478-
479481
#### Forbidden and Safelisted Header Names
480482

481483
* https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For detailed information on the parsing process and potential validation errors,
2727
* **clientFactory** `(origin: URL, opts: Object) => Dispatcher` (optional) - Default: `(origin, opts) => new Pool(origin, opts)`
2828
* **requestTls** `BuildOptions` (optional) - Options object passed when creating the underlying socket via the connector builder for the request. It extends from [`Client#ConnectOptions`](/docs/docs/api/Client.md#parameter-connectoptions).
2929
* **proxyTls** `BuildOptions` (optional) - Options object passed when creating the underlying socket via the connector builder for the proxy server. It extends from [`Client#ConnectOptions`](/docs/docs/api/Client.md#parameter-connectoptions).
30-
* **proxyTunnel** `boolean` (optional) - By default, ProxyAgent will request that the Proxy facilitate a tunnel between the endpoint and the agent. Setting `proxyTunnel` to false avoids issuing a CONNECT extension, and includes the endpoint domain and path in each request.
30+
* **proxyTunnel** `boolean` (optional) - For connections involving secure protocols, Undici will always establish a tunnel via the HTTP2 CONNECT extension. If proxyTunnel is set to true, this will occur for unsecured proxy/endpoint connections as well. Currently, there is no way to facilitate HTTP1 IP tunneling as described in https://www.rfc-editor.org/rfc/rfc9484.html#name-http-11-request. If proxyTunnel is set to false (the default), ProxyAgent connections where both the Proxy and Endpoint are unsecured will issue all requests to the Proxy, and prefix the endpoint request path with the endpoint origin address.
3131

3232
Examples:
3333

0 commit comments

Comments
 (0)