Skip to content

deps: update undici to 7.6.0 #57685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/undici/src/docs/docs/api/Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Extends: `undici.Dispatcher`

Agent allow dispatching requests against multiple different origins.
Agent allows dispatching requests against multiple different origins.

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

Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/lib/core/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { InvalidArgumentError } = require('./errors')
const { headerNameLowerCasedRecord } = require('./constants')
const { tree } = require('./tree')

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

class BodyAsyncIterable {
constructor (body) {
Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/lib/handler/cache-revalidation-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const assert = require('node:assert')
* here, which we then just pass on to the next handler (most likely a
* CacheHandler). Note that this assumes the proper headers were already
* included in the request to tell the origin that we want to revalidate the
* response (i.e. if-modified-since).
* response (i.e. if-modified-since or if-none-match).
*
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-validation
*
Expand Down
6 changes: 3 additions & 3 deletions deps/undici/src/lib/interceptor/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const util = require('../core/util')
const CacheHandler = require('../handler/cache-handler')
const MemoryCacheStore = require('../cache/memory-cache-store')
const CacheRevalidationHandler = require('../handler/cache-revalidation-handler')
const { assertCacheStore, assertCacheMethods, makeCacheKey, parseCacheControlHeader } = require('../util/cache.js')
const { assertCacheStore, assertCacheMethods, makeCacheKey, normaliseHeaders, parseCacheControlHeader } = require('../util/cache.js')
const { AbortError } = require('../core/errors.js')

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ function handleResult (
// Check if the response is stale
if (needsRevalidation(result, reqCacheControl)) {
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
// If body is is stream we can't revalidate...
// If body is a stream we can't revalidate...
// TODO (fix): This could be less strict...
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
}
Expand All @@ -233,7 +233,7 @@ function handleResult (
}

let headers = {
...opts.headers,
...normaliseHeaders(opts),
'if-modified-since': new Date(result.cachedAt).toUTCString()
}

Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/lib/llhttp/wasm_build_env.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

> undici@7.5.0 build:wasm
> undici@7.6.0 build:wasm
> node build/wasm.js --docker

> 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
Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/lib/mock/mock-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function safeUrl (path) {
return path
}

const pathSegments = path.split('?')
const pathSegments = path.split('?', 3)

if (pathSegments.length !== 2) {
return path
Expand Down
24 changes: 17 additions & 7 deletions deps/undici/src/lib/util/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,21 @@ function makeCacheKey (opts) {
throw new Error('opts.origin is undefined')
}

/** @type {Record<string, string[] | string>} */
const headers = normaliseHeaders(opts)

return {
origin: opts.origin.toString(),
method: opts.method,
path: opts.path,
headers
}
}

/**
* @param {Record<string, string[] | string>}
* @return {Record<string, string[] | string>}
*/
function normaliseHeaders (opts) {
let headers
if (opts.headers == null) {
headers = {}
Expand All @@ -38,12 +52,7 @@ function makeCacheKey (opts) {
throw new Error('opts.headers is not an object')
}

return {
origin: opts.origin.toString(),
method: opts.method,
path: opts.path,
headers
}
return headers
}

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

module.exports = {
makeCacheKey,
normaliseHeaders,
assertCacheKey,
assertCacheValue,
parseCacheControlHeader,
Expand Down
7 changes: 4 additions & 3 deletions deps/undici/src/lib/web/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ function finalizeAndReportTiming (response, initiatorType = 'other') {
originalURL.href,
initiatorType,
globalThis,
cacheState
cacheState,
'', // bodyType
response.status
)
}

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

Expand Down Expand Up @@ -1036,7 +1038,6 @@ function fetchFinale (fetchParams, response) {
// fetchParams’s request’s URL, fetchParams’s request’s initiator type, global, cacheState, bodyInfo,
// and responseStatus.
if (fetchParams.request.initiatorType != null) {
// TODO: update markresourcetiming
markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus)
}
}
Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/lib/web/websocket/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function parseExtensions (extensions) {

while (position.position < extensions.length) {
const pair = collectASequenceOfCodePointsFast(';', extensions, position)
const [name, value = ''] = pair.split('=')
const [name, value = ''] = pair.split('=', 2)

extensionList.set(
removeHTTPWhitespace(name, true, false),
Expand Down
Loading
Loading