Skip to content

Commit 0821b44

Browse files
nodejs-github-bottargos
authored andcommitted
deps: update undici to 7.14.0
PR-URL: #59507 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent dafee05 commit 0821b44

File tree

23 files changed

+1653
-1374
lines changed

23 files changed

+1653
-1374
lines changed

‎deps/undici/src/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,11 @@ and `undici.Agent`) which will enable the family autoselection algorithm when es
622622

623623
Undici aligns with the Node.js LTS schedule. The following table shows the supported versions:
624624

625-
| Version | Node.js | End of Life |
626-
|---------|-------------|-------------|
627-
| 5.x | v18.x | 2024-04-30 |
628-
| 6.x | v20.x v22.x| 2026-04-30 |
629-
| 7.x | v24.x | 2027-04-30 |
625+
|Undici Version |Bundled in Node.js | Node.js Versions Supported| End of Life |
626+
|----------------|-------------------|----------------------------|-------------|
627+
| 5.x | 18.x | ≥14.0 (tested: 14, 16, 18)| 2024-04-30 |
628+
| 6.x | 20.x, 22.x | ≥18.17 (tested: 18, 20, 21, 22)| 2026-04-30 |
629+
| 7.x | 24.x | ≥20.18.1 (tested: 20, 22, 24)| 2027-04-30 |
630630

631631
## License
632632

‎deps/undici/src/docs/docs/api/DiagnosticsChannel.md‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,38 @@ This message is published after the client has successfully connected to a serve
169169
```js
170170
importdiagnosticsChannelfrom'diagnostics_channel'
171171

172-
diagnosticsChannel.channel('undici:websocket:open').subscribe(({address, protocol, extensions, websocket }) =>{
172+
diagnosticsChannel.channel('undici:websocket:open').subscribe(({
173+
address, //{address: string, family: string, port: number }
174+
protocol, // string - negotiated subprotocol
175+
extensions, // string - negotiated extensions
176+
websocket, // WebSocket - the WebSocket instance
177+
handshakeResponse // object - HTTP response that upgraded the connection
178+
}) =>{
173179
console.log(address) // address, family, and port
174180
console.log(protocol) // negotiated subprotocols
175181
console.log(extensions) // negotiated extensions
176182
console.log(websocket) // the WebSocket instance
183+
184+
// Handshake response details
185+
console.log(handshakeResponse.status) // 101 for successful WebSocket upgrade
186+
console.log(handshakeResponse.statusText) // 'Switching Protocols'
187+
console.log(handshakeResponse.headers) // Object containing response headers
177188
})
178189
```
179190

191+
### Handshake Response Object
192+
193+
The `handshakeResponse` object contains the HTTP response that upgraded the connection to WebSocket:
194+
195+
-`status` (number): The HTTP status code (101 for successful WebSocket upgrade)
196+
-`statusText` (string): The HTTP status message ('Switching Protocols' for successful upgrade)
197+
-`headers` (object): The HTTP response headers from the server, including:
198+
-`upgrade: 'websocket'`
199+
-`connection: 'upgrade'`
200+
-`sec-websocket-accept` and other WebSocket-related headers
201+
202+
This information is particularly useful for debugging and monitoring WebSocket connections, as it provides access to the initial HTTP handshake response that established the WebSocket connection.
203+
180204
## `undici:websocket:close`
181205

182206
This message is published after the connection has closed.

‎deps/undici/src/lib/dispatcher/proxy-agent.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

33
const{ kProxy, kClose, kDestroy, kDispatch }=require('../core/symbols')
4-
const{URL}=require('node:url')
54
constAgent=require('./agent')
65
constPool=require('./pool')
76
constDispatcherBase=require('./dispatcher-base')
@@ -208,7 +207,7 @@ class ProxyAgent extends DispatcherBase{
208207
}
209208

210209
/**
211-
* @param{import('../types/proxy-agent').ProxyAgent.Options | string | URL} opts
210+
* @param{import('../../types/proxy-agent').ProxyAgent.Options | string | URL} opts
212211
* @returns{URL}
213212
*/
214213
#getUrl (opts){

‎deps/undici/src/lib/handler/cache-handler.js‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ const HEURISTICALLY_CACHEABLE_STATUS_CODES = [
1515
200,203,204,206,300,301,308,404,405,410,414,501
1616
]
1717

18+
// Status codes which semantic is not handled by the cache
19+
// https://datatracker.ietf.org/doc/html/rfc9111#section-3
20+
// This list should not grow beyond 206 and 304 unless the RFC is updated
21+
// by a newer one including more. Please introduce another list if
22+
// implementing caching of responses with the 'must-understand' directive.
23+
constNOT_UNDERSTOOD_STATUS_CODES=[
24+
206,304
25+
]
26+
1827
constMAX_RESPONSE_AGE=2147483647000
1928

2029
/**
@@ -241,10 +250,19 @@ class CacheHandler{
241250
* @param{import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives} cacheControlDirectives
242251
*/
243252
functioncanCacheResponse(cacheType,statusCode,resHeaders,cacheControlDirectives){
244-
// Allow caching for status codes 200 and 307 (original behavior)
245-
// Also allow caching for other status codes that are heuristically cacheable
246-
// when they have explicit cache directives
247-
if(statusCode!==200&&statusCode!==307&&!HEURISTICALLY_CACHEABLE_STATUS_CODES.includes(statusCode)){
253+
// Status code must be final and understood.
254+
if(statusCode<200||NOT_UNDERSTOOD_STATUS_CODES.includes(statusCode)){
255+
returnfalse
256+
}
257+
// Responses with neither status codes that are heuristically cacheable, nor "explicit enough" caching
258+
// directives, are not cacheable. "Explicit enough": see https://www.rfc-editor.org/rfc/rfc9111.html#section-3
259+
if(!HEURISTICALLY_CACHEABLE_STATUS_CODES.includes(statusCode)&&!resHeaders['expires']&&
260+
!cacheControlDirectives.public&&
261+
cacheControlDirectives['max-age']===undefined&&
262+
// RFC 9111: a private response directive, if the cache is not shared
263+
!(cacheControlDirectives.private&&cacheType==='private')&&
264+
!(cacheControlDirectives['s-maxage']!==undefined&&cacheType==='shared')
265+
){
248266
returnfalse
249267
}
250268

‎deps/undici/src/lib/interceptor/cache.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const util = require('../core/util')
66
constCacheHandler=require('../handler/cache-handler')
77
constMemoryCacheStore=require('../cache/memory-cache-store')
88
constCacheRevalidationHandler=require('../handler/cache-revalidation-handler')
9-
const{ assertCacheStore, assertCacheMethods, makeCacheKey,normaliseHeaders, parseCacheControlHeader }=require('../util/cache.js')
9+
const{ assertCacheStore, assertCacheMethods, makeCacheKey,normalizeHeaders, parseCacheControlHeader }=require('../util/cache.js')
1010
const{ AbortError }=require('../core/errors.js')
1111

1212
/**
@@ -326,7 +326,7 @@ module.exports = (opts ={}) =>{
326326

327327
opts={
328328
...opts,
329-
headers: normaliseHeaders(opts)
329+
headers: normalizeHeaders(opts)
330330
}
331331

332332
constreqCacheControl=opts.headers?.['cache-control']

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
> undici@7.13.0 build:wasm
2+
> undici@7.14.0 build:wasm
33
> node build/wasm.js --docker
44

55
> docker run --rm --platform=linux/x86_64 --user 1001:118 --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/lib/llhttp,target=/home/node/build/lib/llhttp --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/build,target=/home/node/build/build --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/deps,target=/home/node/build/deps -t ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970 node build/wasm.js

0 commit comments

Comments
(0)