Skip to content

Commit c377394

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update undici to 7.6.0
PR-URL: #57685 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 35096b7 commit c377394

13 files changed

Lines changed: 517 additions & 205 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Extends: `undici.Dispatcher`
44

5-
Agent allow dispatching requests against multiple different origins.
5+
Agent allows dispatching requests against multiple different origins.
66

77
Requests are not guaranteed to be dispatched in order of invocation.
88

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { InvalidArgumentError } = require('./errors')
1313
const{ headerNameLowerCasedRecord }=require('./constants')
1414
const{ tree }=require('./tree')
1515

16-
const[nodeMajor,nodeMinor]=process.versions.node.split('.').map(v=>Number(v))
16+
const[nodeMajor,nodeMinor]=process.versions.node.split('.',2).map(v=>Number(v))
1717

1818
classBodyAsyncIterable{
1919
constructor(body){

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const assert = require('node:assert')
99
* here, which we then just pass on to the next handler (most likely a
1010
* CacheHandler). Note that this assumes the proper headers were already
1111
* included in the request to tell the origin that we want to revalidate the
12-
* response (i.e. if-modified-since).
12+
* response (i.e. if-modified-since or if-none-match).
1313
*
1414
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-validation
1515
*

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

Lines changed: 3 additions & 3 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, parseCacheControlHeader }=require('../util/cache.js')
9+
const{ assertCacheStore, assertCacheMethods, makeCacheKey,normaliseHeaders,parseCacheControlHeader }=require('../util/cache.js')
1010
const{ AbortError }=require('../core/errors.js')
1111

1212
/**
@@ -221,7 +221,7 @@ function handleResult (
221221
// Check if the response is stale
222222
if(needsRevalidation(result,reqCacheControl)){
223223
if(util.isStream(opts.body)&&util.bodyLength(opts.body)!==0){
224-
// If body is is stream we can't revalidate...
224+
// If body is a stream we can't revalidate...
225225
// TODO (fix): This could be less strict...
226226
returndispatch(opts,newCacheHandler(globalOpts,cacheKey,handler))
227227
}
@@ -233,7 +233,7 @@ function handleResult (
233233
}
234234

235235
letheaders={
236-
...opts.headers,
236+
...normaliseHeaders(opts),
237237
'if-modified-since': newDate(result.cachedAt).toUTCString()
238238
}
239239

‎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.5.0 build:wasm
2+
> undici@7.6.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

‎deps/undici/src/lib/mock/mock-utils.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function safeUrl (path) {
9797
returnpath
9898
}
9999

100-
constpathSegments=path.split('?')
100+
constpathSegments=path.split('?',3)
101101

102102
if(pathSegments.length!==2){
103103
returnpath

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,21 @@ function makeCacheKey (opts) {
1212
thrownewError('opts.origin is undefined')
1313
}
1414

15-
/** @type {Record<string, string[] | string>} */
15+
constheaders=normaliseHeaders(opts)
16+
17+
return{
18+
origin: opts.origin.toString(),
19+
method: opts.method,
20+
path: opts.path,
21+
headers
22+
}
23+
}
24+
25+
/**
26+
* @param {Record<string, string[] | string>}
27+
* @return {Record<string, string[] | string>}
28+
*/
29+
functionnormaliseHeaders(opts){
1630
letheaders
1731
if(opts.headers==null){
1832
headers={}
@@ -38,12 +52,7 @@ function makeCacheKey (opts) {
3852
thrownewError('opts.headers is not an object')
3953
}
4054

41-
return{
42-
origin: opts.origin.toString(),
43-
method: opts.method,
44-
path: opts.path,
45-
headers
46-
}
55+
returnheaders
4756
}
4857

4958
/**
@@ -350,6 +359,7 @@ function assertCacheMethods (methods, name = 'CacheMethods') {
350359

351360
module.exports={
352361
makeCacheKey,
362+
normaliseHeaders,
353363
assertCacheKey,
354364
assertCacheValue,
355365
parseCacheControlHeader,

‎deps/undici/src/lib/web/fetch/index.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ function finalizeAndReportTiming (response, initiatorType = 'other') {
309309
originalURL.href,
310310
initiatorType,
311311
globalThis,
312-
cacheState
312+
cacheState,
313+
'',// bodyType
314+
response.status
313315
)
314316
}
315317

@@ -994,7 +996,7 @@ function fetchFinale (fetchParams, response) {
994996
// 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
995997
fetchParams.controller.reportTimingSteps=()=>{
996998
// 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
997-
if(fetchParams.request.url.protocol!=='https:'){
999+
if(!urlIsHttpHttpsScheme(fetchParams.request.url)){
9981000
return
9991001
}
10001002

@@ -1036,7 +1038,6 @@ function fetchFinale (fetchParams, response) {
10361038
// fetchParams’s request’s URL, fetchParams’s request’s initiator type, global, cacheState, bodyInfo,
10371039
// and responseStatus.
10381040
if(fetchParams.request.initiatorType!=null){
1039-
// TODO: update markresourcetiming
10401041
markResourceTiming(timingInfo,fetchParams.request.url.href,fetchParams.request.initiatorType,globalThis,cacheState,bodyInfo,responseStatus)
10411042
}
10421043
}

‎deps/undici/src/lib/web/websocket/util.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function parseExtensions (extensions) {
206206

207207
while(position.position<extensions.length){
208208
constpair=collectASequenceOfCodePointsFast(';',extensions,position)
209-
const[name,value='']=pair.split('=')
209+
const[name,value='']=pair.split('=',2)
210210

211211
extensionList.set(
212212
removeHTTPWhitespace(name,true,false),

0 commit comments

Comments
 (0)