deps: update undici to 7.29.0

PR-URL: https://github.com/nodejs/node/pull/64713
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and RafaelGSS committed 2026-07-27 19:51:49 -03:00
1 parent 05f541b5c0
commit bcfe21d3dc
16 files changed
+1210 -446

No files matched your search

+55 -10
View File
@@ -218,17 +218,62 @@ class MemoryCacheStore extends EventEmitter {
}
function findEntry (key, entries, now) {
return entries.find((entry) => (
entry.deleteAt > now &&
entry.method === key.method &&
(entry.vary == null || Object.keys(entry.vary).every(headerName => {
if (entry.vary[headerName] === null) {
return key.headers[headerName] === undefined
}
for (let i = 0; i < entries.length; i++) {
const entry = entries[i]
if (
entry.deleteAt > now &&
entry.method === key.method &&
varyMatches(key, entry)
) {
return entry
}
}
}
return entry.vary[headerName] === key.headers[headerName]
}))
))
function varyMatches (key, entry) {
if (entry.vary == null) {
return true
}
for (const headerName in entry.vary) {
if (Object.hasOwn(entry.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry.vary[headerName])) {
return false
}
}
return true
}
/**
* @param {string|string[]|null|undefined} lhs
* @param {string|string[]|null|undefined} rhs
* @returns {boolean}
*/
function headerValueEquals (lhs, rhs) {
if (lhs == null && rhs == null) {
return true
}
if ((lhs == null && rhs != null) ||
(lhs != null && rhs == null)) {
return false
}
if (Array.isArray(lhs) && Array.isArray(rhs)) {
if (lhs.length !== rhs.length) {
return false
}
for (let i = 0; i < lhs.length; i++) {
if (lhs[i] !== rhs[i]) {
return false
}
}
return true
}
return lhs === rhs
}
module.exports = MemoryCacheStore
+7 -1
View File
@@ -454,7 +454,13 @@ function headerValueEquals (lhs, rhs) {
return false
}
return lhs.every((x, i) => x === rhs[i])
for (let i = 0; i < lhs.length; i++) {
if (lhs[i] !== rhs[i]) {
return false
}
}
return true
}
return lhs === rhs
+12 -1
View File
@@ -390,7 +390,13 @@ function processHeader (request, key, val) {
} else if (typeof val[i] === 'object') {
throw new InvalidArgumentError(`invalid ${key} header`)
} else {
arr.push(`${val[i]}`)
// Coerce primitives (and reject unsafe coercions such as functions
// with a crafted toString/Symbol.toPrimitive).
const str = `${val[i]}`
if (!isValidHeaderValue(str)) {
throw new InvalidArgumentError(`invalid ${key} header`)
}
arr.push(str)
}
}
val = arr
@@ -401,7 +407,12 @@ function processHeader (request, key, val) {
} else if (val === null) {
val = ''
} else {
// Coerce primitives (and reject unsafe coercions such as functions
// with a crafted toString/Symbol.toPrimitive).
val = `${val}`
if (!isValidHeaderValue(val)) {
throw new InvalidArgumentError(`invalid ${key} header`)
}
}
if (headerName === 'host') {
+11 -2
View File
@@ -10,6 +10,7 @@ const {
RequestContentLengthMismatchError,
ResponseContentLengthMismatchError,
RequestAbortedError,
InvalidArgumentError,
HeadersTimeoutError,
HeadersOverflowError,
SocketError,
@@ -1134,8 +1135,16 @@ function writeH1 (client, request) {
}
body = bodyStream.stream
contentLength = bodyStream.length
} else if (util.isBlobLike(body) && request.contentType == null && body.type) {
headers.push('content-type', body.type)
} else if (util.isBlobLike(body) && request.contentType == null) {
const contentType = body.type
if (contentType) {
const contentTypeValue = `${contentType}`
if (!util.isValidHeaderValue(contentTypeValue)) {
util.errorRequest(client, request, new InvalidArgumentError('invalid content-type header'))
return false
}
headers.push('content-type', contentTypeValue)
}
}
if (body && typeof body.read === 'function') {
+251 -69
View File
@@ -3,7 +3,10 @@
const util = require('../core/util')
const {
parseCacheControlHeader,
hasInvalidCacheControlDirective,
parseVaryHeader,
hasVaryStar,
isInvalidOrWildcardVaryHeader,
isEtagUsable
} = require('../util/cache')
const { parseHttpDate } = require('../util/date.js')
@@ -26,6 +29,92 @@ const NOT_UNDERSTOOD_STATUS_CODES = [
const MAX_RESPONSE_AGE = 2147483647000
function trimOWS (value) {
return value.replace(/^[\t ]+|[\t ]+$/g, '')
}
function arrayIncludes (array, value) {
for (let i = 0; i < array.length; i++) {
if (array[i] === value) {
return true
}
}
return false
}
function appendConnectionHeaderTokens (headersToRemove, connectionHeader) {
const values = Array.isArray(connectionHeader) ? connectionHeader : [connectionHeader]
for (let i = 0; i < values.length; i++) {
const tokens = values[i].split(',')
for (let j = 0; j < tokens.length; j++) {
headersToRemove.push(trimOWS(tokens[j]).toLowerCase())
}
}
}
function getSameOriginPath (cacheKey, location) {
if (typeof location !== 'string') {
return undefined
}
let originUrl
let requestUrl
let locationUrl
try {
originUrl = new URL(cacheKey.origin)
requestUrl = new URL(cacheKey.path, originUrl)
locationUrl = new URL(location, requestUrl)
} catch {
return undefined
}
if (locationUrl.origin !== originUrl.origin) {
return undefined
}
return locationUrl.pathname + locationUrl.search
}
function deleteCachedUri (store, cacheKey, path) {
deleteCachedValue(store, {
...cacheKey,
path
})
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
const method = util.safeHTTPMethods[i]
if (method !== cacheKey.method) {
deleteCachedValue(store, {
...cacheKey,
method,
path
})
}
}
}
function deleteLocationTargets (store, cacheKey, headerValue) {
if (headerValue === undefined) {
return
}
const values = Array.isArray(headerValue) ? headerValue : [headerValue]
for (let i = 0; i < values.length; i++) {
const path = getSameOriginPath(cacheKey, values[i])
if (path !== undefined) {
deleteCachedUri(store, cacheKey, path)
}
}
}
function invalidateUnsafeRequest (store, cacheKey, resHeaders) {
deleteCachedUri(store, cacheKey, cacheKey.path)
deleteLocationTargets(store, cacheKey, resHeaders.location)
deleteLocationTargets(store, cacheKey, resHeaders['content-location'])
}
/**
* @typedef {import('../../types/dispatcher.d.ts').default.DispatchHandler} DispatchHandler
*
@@ -107,28 +196,28 @@ class CacheHandler {
const handler = this
if (
!util.safeHTTPMethods.includes(this.#cacheKey.method) &&
!arrayIncludes(util.safeHTTPMethods, this.#cacheKey.method) &&
statusCode >= 200 &&
statusCode <= 399
) {
// Successful response to an unsafe method, delete it from cache
// https://www.rfc-editor.org/rfc/rfc9111.html#name-invalidating-stored-response
try {
this.#store.delete(this.#cacheKey)?.catch?.(noop)
} catch {
// Fail silently
}
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders)
return downstreamOnHeaders()
}
const cacheControlHeader = resHeaders['cache-control']
const heuristicallyCacheable = resHeaders['last-modified'] && HEURISTICALLY_CACHEABLE_STATUS_CODES.includes(statusCode)
const heuristicallyCacheable = resHeaders['last-modified'] && arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode)
if (
!cacheControlHeader &&
!resHeaders['expires'] &&
!heuristicallyCacheable &&
!this.#cacheByDefault
) {
if (statusCode === 304 && resHeaders.vary && isInvalidOrWildcardVaryHeader(resHeaders.vary)) {
deleteCachedValue(this.#store, this.#cacheKey)
}
// Don't have anything to tell us this response is cachable and we're not
// caching by default
return downstreamOnHeaders()
@@ -136,31 +225,46 @@ class CacheHandler {
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {}
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives, this.#cacheKey.headers)) {
if (statusCode === 304 && (cacheControlHeader || revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives))) {
deleteCachedValue(this.#store, this.#cacheKey)
}
return downstreamOnHeaders()
}
const now = Date.now()
const resAge = resHeaders.age ? getAge(resHeaders.age) : undefined
if (resAge && resAge >= MAX_RESPONSE_AGE) {
const resAge = Object.hasOwn(resHeaders, 'age') ? getAge(resHeaders.age) : undefined
if (resAge !== undefined && resAge >= MAX_RESPONSE_AGE) {
// Response considered stale
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey)
return downstreamOnHeaders()
}
const resDate = typeof resHeaders.date === 'string'
? parseHttpDate(resHeaders.date)
: undefined
const resDate = Object.hasOwn(resHeaders, 'date') ? getDate(resHeaders.date) : undefined
if (resDate === null) {
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey)
return downstreamOnHeaders()
}
const apparentAge = resDate ? Math.max(0, now - resDate.getTime()) : 0
const currentAge = Math.max(apparentAge, resAge ?? 0)
const staleAt =
determineStaleAt(this.#cacheType, now, resAge, resHeaders, resDate, cacheControlDirectives) ??
this.#cacheByDefault
if (staleAt === undefined || (resAge && resAge > staleAt)) {
if (staleAt === undefined || currentAge >= staleAt) {
if (cacheControlHeader || staleAt !== undefined) {
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey)
}
return downstreamOnHeaders()
}
const baseTime = resDate ? resDate.getTime() : now
const baseTime = now - currentAge
const absoluteStaleAt = staleAt + baseTime
if (now >= absoluteStaleAt) {
// Response is already stale
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey)
return downstreamOnHeaders()
}
@@ -173,7 +277,8 @@ class CacheHandler {
}
}
const deleteAt = determineDeleteAt(baseTime, cacheControlDirectives, absoluteStaleAt)
const cachedAt = baseTime
const deleteAt = determineDeleteAt(baseTime, now, cacheControlDirectives, absoluteStaleAt)
const strippedHeaders = stripNecessaryHeaders(resHeaders, cacheControlDirectives)
/**
@@ -185,7 +290,7 @@ class CacheHandler {
headers: strippedHeaders,
vary: varyDirectives,
cacheControlDirectives,
cachedAt: resAge ? now - resAge : now,
cachedAt,
staleAt: absoluteStaleAt,
deleteAt
}
@@ -203,6 +308,7 @@ class CacheHandler {
value.statusCode = cachedValue.statusCode
value.statusMessage = cachedValue.statusMessage
value.etag = cachedValue.etag
value.vary = varyDirectives ?? cachedValue.vary
value.headers = { ...cachedValue.headers, ...strippedHeaders }
downstreamOnHeaders()
@@ -333,6 +439,36 @@ class CacheHandler {
}
}
/**
* @param {import('../../types/cache-interceptor.d.ts').default.CacheStore} store
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
*/
function deleteCachedValue (store, cacheKey) {
try {
store.delete(cacheKey)?.catch?.(noop)
} catch {
// Fail silently
}
}
function deleteCachedValueIfNotModified (statusCode, store, cacheKey) {
if (statusCode === 304) {
deleteCachedValue(store, cacheKey)
}
}
/**
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} resHeaders
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives} cacheControlDirectives
* @returns {boolean}
*/
function revalidationResponseDisallowsCachedReuse (cacheType, resHeaders, cacheControlDirectives) {
return cacheControlDirectives['no-store'] === true ||
(cacheType === 'shared' && cacheControlDirectives.private === true) ||
(resHeaders.vary ? isInvalidOrWildcardVaryHeader(resHeaders.vary) : false)
}
/**
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-storing-responses-to-authen
*
@@ -344,12 +480,12 @@ class CacheHandler {
*/
function canCacheResponse (cacheType, statusCode, resHeaders, cacheControlDirectives, reqHeaders) {
// Status code must be final and understood.
if (statusCode < 200 || NOT_UNDERSTOOD_STATUS_CODES.includes(statusCode)) {
if (statusCode < 200 || arrayIncludes(NOT_UNDERSTOOD_STATUS_CODES, statusCode)) {
return false
}
// Responses with neither status codes that are heuristically cacheable, nor "explicit enough" caching
// directives, are not cacheable. "Explicit enough": see https://www.rfc-editor.org/rfc/rfc9111.html#section-3
if (!HEURISTICALLY_CACHEABLE_STATUS_CODES.includes(statusCode) && !resHeaders['expires'] &&
if (!arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode) && !resHeaders['expires'] &&
!cacheControlDirectives.public &&
cacheControlDirectives['max-age'] === undefined &&
// RFC 9111: a private response directive, if the cache is not shared
@@ -368,12 +504,12 @@ function canCacheResponse (cacheType, statusCode, resHeaders, cacheControlDirect
}
// https://www.rfc-editor.org/rfc/rfc9111.html#section-4.1-5
if (resHeaders.vary?.includes('*')) {
if (resHeaders.vary && hasVaryStar(resHeaders.vary)) {
return false
}
// https://www.rfc-editor.org/rfc/rfc9111.html#name-storing-responses-to-authen
if (reqHeaders?.authorization) {
if (reqHeaders != null && Object.hasOwn(reqHeaders, 'authorization')) {
if (
!cacheControlDirectives.public &&
!cacheControlDirectives['s-maxage'] &&
@@ -388,14 +524,14 @@ function canCacheResponse (cacheType, statusCode, resHeaders, cacheControlDirect
if (
Array.isArray(cacheControlDirectives['no-cache']) &&
cacheControlDirectives['no-cache'].includes('authorization')
arrayIncludes(cacheControlDirectives['no-cache'], 'authorization')
) {
return false
}
if (
Array.isArray(cacheControlDirectives['private']) &&
cacheControlDirectives['private'].includes('authorization')
arrayIncludes(cacheControlDirectives['private'], 'authorization')
) {
return false
}
@@ -404,14 +540,51 @@ function canCacheResponse (cacheType, statusCode, resHeaders, cacheControlDirect
return true
}
/**
* @param {string | string[]} dateHeader
* @returns {Date | null | undefined}
*/
function getDate (dateHeader) {
let dateValue = dateHeader
if (Array.isArray(dateValue)) {
if (dateValue.length !== 1) {
return null
}
dateValue = dateValue[0]
}
if (typeof dateValue !== 'string') {
return null
}
return parseHttpDate(dateValue)
}
/**
* @param {string | string[]} ageHeader
* @returns {number | undefined}
*/
function getAge (ageHeader) {
const age = parseInt(Array.isArray(ageHeader) ? ageHeader[0] : ageHeader)
let ageValue = ageHeader
if (Array.isArray(ageValue)) {
if (ageValue.length !== 1) {
return MAX_RESPONSE_AGE
}
return isNaN(age) ? undefined : age * 1000
ageValue = ageValue[0]
}
if (typeof ageValue !== 'string' || !/^[\t ]*[0-9]+[\t ]*$/.test(ageValue)) {
return MAX_RESPONSE_AGE
}
const age = BigInt(ageValue.replace(/^[\t ]+|[\t ]+$/g, ''))
if (age >= BigInt(MAX_RESPONSE_AGE / 1000)) {
return MAX_RESPONSE_AGE
}
return Number(age) * 1000
}
/**
@@ -429,43 +602,60 @@ function determineStaleAt (cacheType, now, age, resHeaders, responseDate, cacheC
// Prioritize s-maxage since we're a shared cache
// s-maxage > max-age > Expire
// https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.2.10-3
if (hasInvalidCacheControlDirective(cacheControlDirectives, 's-maxage')) {
return 0
}
const sMaxAge = cacheControlDirectives['s-maxage']
if (sMaxAge !== undefined) {
return sMaxAge > 0 ? sMaxAge * 1000 : undefined
return sMaxAge * 1000
}
}
if (hasInvalidCacheControlDirective(cacheControlDirectives, 'max-age')) {
return 0
}
const maxAge = cacheControlDirectives['max-age']
if (maxAge !== undefined) {
return maxAge > 0 ? maxAge * 1000 : undefined
return maxAge * 1000
}
if (typeof resHeaders.expires === 'string') {
if (Object.hasOwn(resHeaders, 'expires')) {
// https://www.rfc-editor.org/rfc/rfc9111.html#section-5.3
const expiresDate = parseHttpDate(resHeaders.expires)
if (expiresDate) {
if (now >= expiresDate.getTime()) {
return undefined
}
if (responseDate) {
if (responseDate >= expiresDate) {
return undefined
}
if (age !== undefined && age > (expiresDate - responseDate)) {
return undefined
}
}
return expiresDate.getTime() - now
if (typeof resHeaders.expires !== 'string') {
return 0
}
const expiresDate = parseHttpDate(resHeaders.expires)
if (!expiresDate) {
return 0
}
if (now >= expiresDate.getTime()) {
return 0
}
if (responseDate) {
if (responseDate >= expiresDate) {
return 0
}
const freshnessLifetime = expiresDate.getTime() - responseDate.getTime()
if (age !== undefined && age >= freshnessLifetime) {
return 0
}
return freshnessLifetime
}
return expiresDate.getTime() - now
}
if (typeof resHeaders['last-modified'] === 'string') {
// https://www.rfc-editor.org/rfc/rfc9111.html#name-calculating-heuristic-fresh
const lastModified = new Date(resHeaders['last-modified'])
if (isValidDate(lastModified)) {
const lastModified = parseHttpDate(resHeaders['last-modified'])
if (lastModified) {
if (lastModified.getTime() >= now) {
return undefined
}
@@ -478,18 +668,19 @@ function determineStaleAt (cacheType, now, age, resHeaders, responseDate, cacheC
if (cacheControlDirectives.immutable) {
// https://www.rfc-editor.org/rfc/rfc8246.html#section-2.2
return 31536000
return 31536000000
}
return undefined
}
/**
* @param {number} now
* @param {number} baseTime
* @param {number} cachedAt
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives} cacheControlDirectives
* @param {number} staleAt
*/
function determineDeleteAt (now, cacheControlDirectives, staleAt) {
function determineDeleteAt (baseTime, cachedAt, cacheControlDirectives, staleAt) {
let staleWhileRevalidate = -Infinity
let staleIfError = -Infinity
let immutable = -Infinity
@@ -503,15 +694,21 @@ function determineDeleteAt (now, cacheControlDirectives, staleAt) {
}
if (cacheControlDirectives.immutable && staleWhileRevalidate === -Infinity && staleIfError === -Infinity) {
immutable = now + 31536000000
immutable = cachedAt + 31536000000
}
// When no stale directives or immutable flag, add a revalidation buffer
// equal to the freshness lifetime so the entry survives past staleAt long
// enough to be revalidated instead of silently disappearing.
//
// Response Date headers only have second precision, so baseTime can trail the
// actual cache insertion time by up to ~1s. Pad the buffer by that bounded
// skew so short-lived entries do not disappear exactly when they should be
// revalidated.
if (staleWhileRevalidate === -Infinity && staleIfError === -Infinity && immutable === -Infinity) {
const freshnessLifetime = staleAt - now
return staleAt + freshnessLifetime
const freshnessLifetime = staleAt - baseTime
const datePrecisionPadding = Math.min(Math.max(cachedAt - baseTime, 0), 1000)
return staleAt + freshnessLifetime + datePrecisionPadding
}
return Math.max(staleAt, staleWhileRevalidate, staleIfError, immutable)
@@ -538,14 +735,7 @@ function stripNecessaryHeaders (resHeaders, cacheControlDirectives) {
]
if (resHeaders['connection']) {
if (Array.isArray(resHeaders['connection'])) {
// connection: a
// connection: b
headersToRemove.push(...resHeaders['connection'].map(header => header.trim()))
} else {
// connection: a, b
headersToRemove.push(...resHeaders['connection'].split(',').map(header => header.trim()))
}
appendConnectionHeaderTokens(headersToRemove, resHeaders['connection'])
}
if (Array.isArray(cacheControlDirectives['no-cache'])) {
@@ -558,7 +748,7 @@ function stripNecessaryHeaders (resHeaders, cacheControlDirectives) {
let strippedHeaders
for (const headerName of headersToRemove) {
if (resHeaders[headerName]) {
if (Object.hasOwn(resHeaders, headerName)) {
strippedHeaders ??= { ...resHeaders }
delete strippedHeaders[headerName]
}
@@ -567,12 +757,4 @@ function stripNecessaryHeaders (resHeaders, cacheControlDirectives) {
return strippedHeaders ?? resHeaders
}
/**
* @param {Date} date
* @returns {boolean}
*/
function isValidDate (date) {
return date instanceof Date && Number.isFinite(date.valueOf())
}
module.exports = CacheHandler
+3 -3
View File
@@ -19,7 +19,7 @@ class CacheRevalidationHandler {
#successful = false
/**
* @type {((boolean, any) => void) | null}
* @type {((success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void) | null}
*/
#callback
@@ -36,7 +36,7 @@ class CacheRevalidationHandler {
#allowErrorStatusCodes
/**
* @param {(boolean) => void} callback Function to call if the cached value is valid
* @param {(success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void} callback Function to call if the cached value is valid
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandlers} handler
* @param {boolean} allowErrorStatusCodes
*/
@@ -71,7 +71,7 @@ class CacheRevalidationHandler {
// https://datatracker.ietf.org/doc/html/rfc5861#section-4
this.#successful = statusCode === 304 ||
(this.#allowErrorStatusCodes && statusCode >= 500 && statusCode <= 504)
this.#callback(this.#successful, this.#context)
this.#callback(this.#successful, this.#context, statusCode, headers)
this.#callback = null
if (this.#successful) {
+24
View File
@@ -15,6 +15,26 @@ function calculateRetryAfterHeader (retryAfter) {
return isNaN(retryTime) ? 0 : retryTime - Date.now()
}
function validatePartialResponseContentLength (headers, range, statusCode, retryCount) {
const contentLength = headers['content-length']
if (contentLength == null) {
return
}
if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) {
return
}
const length = Number(contentLength)
const expectedLength = range.end - range.start + 1
if (!Number.isFinite(length) || length !== expectedLength) {
throw new RequestRetryError('Content-Length mismatch', statusCode, {
headers,
data: { count: retryCount }
})
}
}
class RetryHandler {
constructor (opts, { dispatch, handler }) {
const { retryOptions, ...dispatchOpts } = opts
@@ -229,6 +249,8 @@ class RetryHandler {
})
}
validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount)
const { start, size, end = size ? size - 1 : null } = contentRange
assert(this.start === start, 'content-range mismatch')
@@ -253,6 +275,8 @@ class RetryHandler {
return
}
validatePartialResponseContentLength(headers, range, statusCode, this.retryCount)
const { start, size, end = size ? size - 1 : null } = range
assert(
start != null && Number.isFinite(start),
+160 -53
View File
@@ -6,8 +6,9 @@ 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, normalizeHeaders, parseCacheControlHeader } = require('../util/cache.js')
const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader, isInvalidOrWildcardVaryHeader } = require('../util/cache.js')
const { AbortError } = require('../core/errors.js')
const { parseHttpDate } = require('../util/date.js')
/**
* @param {(string | RegExp)[] | undefined} origins
@@ -28,6 +29,44 @@ function assertCacheOrigins (origins, name) {
const nop = () => {}
function trimOWS (value) {
return value.replace(/^[\t ]+|[\t ]+$/g, '')
}
function arrayIncludes (array, value) {
for (let i = 0; i < array.length; i++) {
if (array[i] === value) {
return true
}
}
return false
}
function hasPragmaNoCache (headers) {
const pragma = headers?.pragma
if (!pragma) {
return false
}
const values = Array.isArray(pragma) ? pragma : [pragma]
for (let i = 0; i < values.length; i++) {
const value = values[i]
if (typeof value !== 'string') {
continue
}
const directives = value.split(',')
for (let j = 0; j < directives.length; j++) {
if (trimOWS(directives[j]).toLowerCase() === 'no-cache') {
return true
}
}
}
return false
}
/**
* @typedef {(options: import('../../types/dispatcher.d.ts').default.DispatchOptions, handler: import('../../types/dispatcher.d.ts').default.DispatchHandler) => void} DispatchFn
*/
@@ -59,14 +98,90 @@ function needsRevalidation (result, cacheControlDirectives, { headers = {} }) {
/**
* @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives | undefined} cacheControlDirectives
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
* @returns {boolean}
*/
function isStale (result, cacheControlDirectives) {
function staleResponseRequiresRevalidation (result, cacheType) {
return result.cacheControlDirectives?.['must-revalidate'] === true ||
(cacheType === 'shared' && (
result.cacheControlDirectives?.['proxy-revalidate'] === true ||
// https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.2.10
// s-maxage implies proxy-revalidate for shared caches.
result.cacheControlDirectives?.['s-maxage'] !== undefined
))
}
/**
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} headers
* @returns {boolean}
*/
function revalidationResponseDisallowsCachedReuse (cacheType, headers) {
if (headers.vary && isInvalidOrWildcardVaryHeader(headers.vary)) {
return true
}
const cacheControl = headers['cache-control']
if (!cacheControl) {
return false
}
const cacheControlDirectives = parseCacheControlHeader(cacheControl)
return cacheControlDirectives['no-store'] === true ||
(cacheType === 'shared' && cacheControlDirectives.private === true)
}
function revalidationResponseUpdatesCacheControl (headers) {
return headers['cache-control'] !== undefined
}
function deleteCachedValue (store, cacheKey) {
try {
store.delete(cacheKey)?.catch?.(nop)
} catch {
// Fail silently
}
}
function getUsableLastModified (headers) {
const lastModified = headers?.['last-modified']
if (typeof lastModified === 'string' && parseHttpDate(lastModified)) {
return lastModified
}
}
function makeRevalidationHeaders (opts, result) {
const headers = {
...opts.headers,
'if-modified-since': getUsableLastModified(result.headers) ?? new Date(result.cachedAt).toUTCString()
}
if (result.etag) {
headers['if-none-match'] = result.etag
}
if (result.vary) {
for (const key in result.vary) {
if (result.vary[key] != null) {
headers[key] = result.vary[key]
}
}
}
return headers
}
/**
* @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives | undefined} cacheControlDirectives
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
* @returns {boolean}
*/
function isStale (result, cacheControlDirectives, cacheType) {
const now = Date.now()
if (now > result.staleAt) {
// Response is stale
if (cacheControlDirectives?.['max-stale']) {
if (!staleResponseRequiresRevalidation(result, cacheType) && cacheControlDirectives?.['max-stale']) {
// There's a threshold where we can serve stale responses, let's see if
// we're in it
// https://www.rfc-editor.org/rfc/rfc9111.html#name-max-stale
@@ -93,11 +208,12 @@ function isStale (result, cacheControlDirectives) {
/**
* Check if we're within the stale-while-revalidate window for a stale response
* @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
* @returns {boolean}
*/
function withinStaleWhileRevalidateWindow (result) {
function withinStaleWhileRevalidateWindow (result, cacheType) {
const staleWhileRevalidate = result.cacheControlDirectives?.['stale-while-revalidate']
if (!staleWhileRevalidate) {
if (!staleWhileRevalidate || staleResponseRequiresRevalidation(result, cacheType)) {
return false
}
@@ -267,14 +383,10 @@ function handleResult (
}
const age = Math.round((now - result.cachedAt) / 1000)
if (reqCacheControl?.['max-age'] && age >= reqCacheControl['max-age']) {
// Response is considered expired for this specific request
// https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.1.1
return dispatch(opts, handler)
}
const requestMaxAgeExpired = reqCacheControl?.['max-age'] !== undefined && age >= reqCacheControl['max-age']
const stale = isStale(result, reqCacheControl)
const revalidate = needsRevalidation(result, reqCacheControl, opts)
const stale = requestMaxAgeExpired || isStale(result, reqCacheControl, globalOpts.type)
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts)
// Check if the response is stale
if (stale || revalidate) {
@@ -286,28 +398,13 @@ function handleResult (
// RFC 5861: If we're within stale-while-revalidate window, serve stale immediately
// and revalidate in background, unless immediate revalidation is necessary
if (!revalidate && withinStaleWhileRevalidateWindow(result)) {
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
// Serve stale response immediately
sendCachedValue(handler, opts, result, age, null, true)
// Start background revalidation (fire-and-forget)
queueMicrotask(() => {
const headers = {
...opts.headers,
'if-modified-since': new Date(result.cachedAt).toUTCString()
}
if (result.etag) {
headers['if-none-match'] = result.etag
}
if (result.vary) {
for (const key in result.vary) {
if (result.vary[key] != null) {
headers[key] = result.vary[key]
}
}
}
const headers = makeRevalidationHeaders(opts, result)
// Background revalidation - update cache if we get new data
dispatch(
@@ -331,28 +428,15 @@ function handleResult (
}
let withinStaleIfErrorThreshold = false
const staleIfErrorExpiry = result.cacheControlDirectives['stale-if-error'] ?? reqCacheControl?.['stale-if-error']
if (staleIfErrorExpiry) {
withinStaleIfErrorThreshold = now < (result.staleAt + (staleIfErrorExpiry * 1000))
}
const headers = {
...opts.headers,
'if-modified-since': new Date(result.cachedAt).toUTCString()
}
if (result.etag) {
headers['if-none-match'] = result.etag
}
if (result.vary) {
for (const key in result.vary) {
if (result.vary[key] != null) {
headers[key] = result.vary[key]
}
if (!staleResponseRequiresRevalidation(result, globalOpts.type)) {
const staleIfErrorExpiry = result.cacheControlDirectives['stale-if-error'] ?? reqCacheControl?.['stale-if-error']
if (staleIfErrorExpiry) {
withinStaleIfErrorThreshold = now < (result.staleAt + (staleIfErrorExpiry * 1000))
}
}
const headers = makeRevalidationHeaders(opts, result)
// We need to revalidate the response
return dispatch(
{
@@ -360,8 +444,23 @@ function handleResult (
headers
},
new CacheRevalidationHandler(
(success, context) => {
(success, context, statusCode, headers) => {
if (success) {
if (statusCode === 304) {
if (revalidationResponseDisallowsCachedReuse(globalOpts.type, headers)) {
if (util.isStream(result.body)) {
result.body.on('error', nop).destroy()
}
deleteCachedValue(globalOpts.store, cacheKey)
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
}
if (revalidationResponseUpdatesCacheControl(headers)) {
deleteCachedValue(globalOpts.store, cacheKey)
}
}
// TODO: successful revalidation should be considered fresh (not give stale warning).
sendCachedValue(handler, opts, result, age, context, stale)
} else if (util.isStream(result.body)) {
@@ -418,11 +517,17 @@ module.exports = (opts = {}) => {
type
}
const safeMethodsToNotCache = util.safeHTTPMethods.filter(method => methods.includes(method) === false)
const safeMethodsToNotCache = []
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
const method = util.safeHTTPMethods[i]
if (!arrayIncludes(methods, method)) {
safeMethodsToNotCache.push(method)
}
}
return dispatch => {
return (opts, handler) => {
if (!opts.origin || safeMethodsToNotCache.includes(opts.method)) {
if (!opts.origin || arrayIncludes(safeMethodsToNotCache, opts.method)) {
// Not a method we want to cache or we don't have the origin, skip
return dispatch(opts, handler)
}
@@ -457,7 +562,9 @@ module.exports = (opts = {}) => {
const reqCacheControl = opts.headers?.['cache-control']
? parseCacheControlHeader(opts.headers['cache-control'])
: undefined
: hasPragmaNoCache(opts.headers)
? { 'no-cache': true }
: undefined
if (reqCacheControl?.['no-store']) {
return dispatch(opts, handler)
+1 -1
View File
@@ -1,5 +1,5 @@
> undici@7.28.0 build:wasm
> undici@7.29.0 build:wasm
> node build/wasm.js --docker
> docker run --rm --platform=linux/x86_64 --user 1001:1001 --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
+328 -66
View File
@@ -3,11 +3,147 @@
const {
safeHTTPMethods,
pathHasQueryOrFragment,
hasSafeIterator
hasSafeIterator,
isValidHTTPToken
} = require('../core/util')
const { serializePathWithQuery } = require('../core/util')
const MAX_DELTA_SECONDS = 2147483647
const RESTRICTIVE_DIRECTIVE_NAMES = ['no-store', 'private', 'no-cache']
const kInvalidCacheControlDirectives = Symbol('invalid cache-control directives')
function trimOWS (value) {
return value.replace(/^[\t ]+|[\t ]+$/g, '')
}
function arrayIncludes (array, value) {
for (let i = 0; i < array.length; i++) {
if (array[i] === value) {
return true
}
}
return false
}
function trimOWSStart (value) {
return value.replace(/^[\t ]+/, '')
}
function trimOWSEnd (value) {
return value.replace(/[\t ]+$/, '')
}
function findUnescapedQuote (value, start) {
let escaped = false
for (let i = start; i < value.length; i++) {
if (escaped) {
escaped = false
} else if (value[i] === '\\') {
escaped = true
} else if (value[i] === '"') {
return i
}
}
return -1
}
function splitCacheControlHeaderValue (value) {
const directives = []
let start = 0
let quoteStart = -1
let inQuote = false
let escaped = false
for (let i = 0; i < value.length; i++) {
if (inQuote) {
if (escaped) {
escaped = false
} else if (value[i] === '\\') {
escaped = true
} else if (value[i] === '"') {
inQuote = false
quoteStart = -1
}
} else if (value[i] === '"') {
inQuote = true
quoteStart = i
} else if (value[i] === ',') {
directives.push({ value: value.substring(start, i), fromMalformedQuote: false })
start = i + 1
}
}
if (!inQuote) {
directives.push({ value: value.substring(start), fromMalformedQuote: false })
return directives
}
const tail = value.substring(start)
const quoteOffset = quoteStart - start
let tailStart = 0
for (let i = 0; i < tail.length; i++) {
if (tail[i] === ',') {
directives.push({
value: tail.substring(tailStart, i),
fromMalformedQuote: tailStart > quoteOffset
})
tailStart = i + 1
}
}
directives.push({
value: tail.substring(tailStart),
fromMalformedQuote: tailStart > quoteOffset
})
return directives
}
function markInvalidCacheControlDirective (directives, key) {
let invalidDirectives = directives[kInvalidCacheControlDirectives]
if (invalidDirectives === undefined) {
invalidDirectives = new Set()
Object.defineProperty(directives, kInvalidCacheControlDirectives, {
value: invalidDirectives
})
}
invalidDirectives.add(key)
}
function hasInvalidCacheControlDirective (directives, key) {
return directives[kInvalidCacheControlDirectives]?.has(key) === true
}
function getMalformedRestrictiveDirectiveName (key) {
for (const directiveName of RESTRICTIVE_DIRECTIVE_NAMES) {
if (
key.startsWith(directiveName) &&
key.length > directiveName.length &&
!isValidHTTPToken(key[directiveName.length])
) {
return directiveName
}
}
let tokenOnlyKey = ''
let hasInvalidTokenChar = false
for (let i = 0; i < key.length; i++) {
if (isValidHTTPToken(key[i])) {
tokenOnlyKey += key[i]
} else {
hasInvalidTokenChar = true
}
}
if (hasInvalidTokenChar && arrayIncludes(RESTRICTIVE_DIRECTIVE_NAMES, tokenOnlyKey)) {
return tokenOnlyKey
}
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
*/
@@ -30,6 +166,20 @@ function makeCacheKey (opts) {
}
}
function appendHeader (headers, key, val) {
const headerName = key.toLowerCase()
const current = headers[headerName]
const values = Array.isArray(val) ? val : [val]
if (current === undefined) {
headers[headerName] = Array.isArray(val) ? val.slice() : val
} else if (Array.isArray(current)) {
current.push(...values)
} else {
headers[headerName] = [current, ...values]
}
}
/**
* @param {Record<string, string[] | string>}
* @returns {Record<string, string[] | string>}
@@ -50,11 +200,11 @@ function normalizeHeaders (opts) {
if (typeof key !== 'string' || typeof val !== 'string') {
throw new Error('opts.headers is not a valid header map')
}
headers[key.toLowerCase()] = val
appendHeader(headers, key, val)
}
} else {
for (const key of Object.keys(opts.headers)) {
headers[key.toLowerCase()] = opts.headers[key]
appendHeader(headers, key, opts.headers[key])
}
}
} else {
@@ -126,29 +276,37 @@ function parseCacheControlHeader (header) {
* @type {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives}
*/
const output = {}
const invalidNumericDirectives = new Set()
const invalidNoArgumentDirectives = new Set()
let directives
if (Array.isArray(header)) {
directives = []
for (const directive of header) {
directives.push(...directive.split(','))
}
} else {
directives = header.split(',')
}
const directives = splitCacheControlHeaderValue(Array.isArray(header) ? header.join(',') : header)
for (let i = 0; i < directives.length; i++) {
const directive = directives[i].toLowerCase()
const directiveRecord = directives[i]
const directive = directiveRecord.value.toLowerCase()
const fromMalformedQuote = directiveRecord.fromMalformedQuote
const keyValueDelimiter = directive.indexOf('=')
let key
let value
let keyHasTrailingWhitespace = false
let valueHasLeadingWhitespace = false
if (keyValueDelimiter !== -1) {
key = directive.substring(0, keyValueDelimiter).trimStart()
value = directive.substring(keyValueDelimiter + 1)
const rawKey = directive.substring(0, keyValueDelimiter)
const rawValue = directive.substring(keyValueDelimiter + 1)
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue
key = trimOWS(rawKey)
value = trimOWSStart(rawValue)
} else {
key = directive.trim()
key = trimOWS(directive)
}
const malformedRestrictiveDirectiveName = getMalformedRestrictiveDirectiveName(key)
if (malformedRestrictiveDirectiveName !== undefined) {
output[malformedRestrictiveDirectiveName] = true
continue
}
switch (key) {
@@ -158,7 +316,14 @@ function parseCacheControlHeader (header) {
case 's-maxage':
case 'stale-while-revalidate':
case 'stale-if-error': {
if (value === undefined || value[0] === ' ') {
if (fromMalformedQuote || invalidNumericDirectives.has(key)) {
continue
}
if (value === undefined || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
delete output[key]
invalidNumericDirectives.add(key)
markInvalidCacheControlDirective(output, key)
continue
}
@@ -170,22 +335,37 @@ function parseCacheControlHeader (header) {
value = value.substring(1, value.length - 1)
}
const parsedValue = parseInt(value, 10)
// eslint-disable-next-line no-self-compare
if (parsedValue !== parsedValue) {
if (!/^[0-9]+$/.test(value)) {
delete output[key]
invalidNumericDirectives.add(key)
markInvalidCacheControlDirective(output, key)
continue
}
if (key === 'max-age' && key in output && output[key] >= parsedValue) {
continue
}
const parsedValue = Math.min(parseInt(value, 10), MAX_DELTA_SECONDS)
output[key] = parsedValue
if (key === 'min-fresh') {
if (!(key in output) || output[key] < parsedValue) {
output[key] = parsedValue
}
} else if (!(key in output) || output[key] > parsedValue) {
output[key] = parsedValue
}
break
}
case 'private':
case 'no-cache': {
if (fromMalformedQuote) {
output[key] = true
break
}
if (value !== undefined && value.length === 0) {
output[key] = true
break
}
if (value) {
// The private and no-cache directives can be unqualified (aka just
// `private` or `no-cache`) or qualified (w/ a value). When they're
@@ -193,45 +373,64 @@ function parseCacheControlHeader (header) {
// `no-cache="header1"`, or `no-cache="header1, header2"`
// If we're given multiple headers, the comma messes us up since
// we split the full header by commas. So, let's loop through the
// remaining parts in front of us until we find one that ends in a
// quote. We can then just splice all of the parts in between the
// starting quote and the ending quote out of the directives array
// and continue parsing like normal.
// remaining parts in front of us until we find one that contains a
// closing quote. We can then skip the consumed quoted-list fragments and
// continue parsing like normal.
// https://www.rfc-editor.org/rfc/rfc9111.html#name-no-cache-2
if (value[0] === '"') {
// Something like `no-cache="some-header"` OR `no-cache="some-header, another-header"`.
value = trimOWSEnd(value)
// Add the first header on and cut off the leading quote
const headers = [value.substring(1)]
let fieldList = ''
let lastQuotedPart = i
let foundEndingQuote = false
const closingQuote = findUnescapedQuote(value, 1)
let foundEndingQuote = value[value.length - 1] === '"'
if (!foundEndingQuote) {
if (closingQuote !== -1) {
fieldList = value.substring(1, closingQuote)
foundEndingQuote = true
} else {
// Something like `no-cache="some-header, another-header"`
// This can still be something invalid, e.g. `no-cache="some-header, ...`
const fieldListParts = [value.substring(1)]
for (let j = i + 1; j < directives.length; j++) {
const nextPart = directives[j]
const nextPartLength = nextPart.length
const nextPart = trimOWS(directives[j].value)
const closingQuote = findUnescapedQuote(nextPart, 0)
headers.push(nextPart.trim())
lastQuotedPart = j
if (nextPartLength !== 0 && nextPart[nextPartLength - 1] === '"') {
if (closingQuote !== -1) {
fieldListParts.push(nextPart.substring(0, closingQuote))
foundEndingQuote = true
break
}
fieldListParts.push(nextPart)
}
fieldList = fieldListParts.join(',')
}
if (!foundEndingQuote) {
output[key] = true
break
}
i = lastQuotedPart
const headers = fieldList.split(',')
let validFieldNames = true
for (let j = 0; j < headers.length; j++) {
headers[j] = trimOWS(headers[j])
if (!isValidHTTPToken(headers[j])) {
validFieldNames = false
}
}
if (foundEndingQuote) {
let lastHeader = headers[headers.length - 1]
if (lastHeader[lastHeader.length - 1] === '"') {
lastHeader = lastHeader.substring(0, lastHeader.length - 1)
headers[headers.length - 1] = lastHeader
}
for (let j = 0; j < headers.length; j++) {
headers[j] = headers[j].trim()
}
if (!validFieldNames) {
output[key] = true
} else if (output[key] !== true) {
if (key in output) {
output[key] = output[key].concat(headers)
} else {
@@ -239,13 +438,17 @@ function parseCacheControlHeader (header) {
}
}
} else {
// Something like `no-cache="some-header"`
const fieldName = value.trim()
// Something like `no-cache=some-header`
const fieldName = trimOWS(value)
if (key in output) {
output[key] = output[key].concat(fieldName)
} else {
output[key] = [fieldName]
if (!isValidHTTPToken(fieldName)) {
output[key] = true
} else if (output[key] !== true) {
if (key in output) {
output[key] = output[key].concat(fieldName)
} else {
output[key] = [fieldName]
}
}
}
@@ -254,19 +457,27 @@ function parseCacheControlHeader (header) {
}
// eslint-disable-next-line no-fallthrough
case 'public':
case 'no-store':
case 'must-revalidate':
case 'proxy-revalidate':
case 'immutable':
case 'no-transform':
case 'must-understand':
case 'only-if-cached':
if (value) {
// These are qualified (something like `public=...`) when they aren't
// allowed to be, skip
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) {
continue
}
if (value !== undefined) {
// These are qualified (something like `public=...`) when they aren't
// allowed to be, skip all instances of the malformed directive.
delete output[key]
invalidNoArgumentDirectives.add(key)
continue
}
output[key] = true
break
case 'no-store':
output[key] = true
break
default:
@@ -278,31 +489,79 @@ function parseCacheControlHeader (header) {
return output
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @returns {string[]}
*/
function splitVaryHeader (varyHeader) {
const values = Array.isArray(varyHeader) ? varyHeader : [varyHeader]
const output = []
for (let i = 0; i < values.length; i++) {
const parts = values[i].split(',')
for (let j = 0; j < parts.length; j++) {
output.push(parts[j])
}
}
return output
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @returns {boolean}
*/
function hasVaryStar (varyHeader) {
const values = splitVaryHeader(varyHeader)
for (let i = 0; i < values.length; i++) {
if (trimOWS(values[i]).indexOf('*') !== -1) {
return true
}
}
return false
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @param {Record<string, string | string[]>} headers Request headers
* @returns {Record<string, string | string[]>}
* @returns {Record<string, string | string[] | null> | undefined}
*/
function parseVaryHeader (varyHeader, headers) {
if (typeof varyHeader === 'string' && varyHeader.includes('*')) {
if (hasVaryStar(varyHeader)) {
return headers
}
const output = /** @type {Record<string, string | string[] | null>} */ ({})
const varyingHeaders = typeof varyHeader === 'string'
? varyHeader.split(',')
: varyHeader
const varyingHeaders = splitVaryHeader(varyHeader)
for (const header of varyingHeaders) {
const trimmedHeader = header.trim().toLowerCase()
const trimmedHeader = trimOWS(header).toLowerCase()
output[trimmedHeader] = headers[trimmedHeader] ?? null
if (trimmedHeader.length === 0) {
continue
}
if (!isValidHTTPToken(trimmedHeader)) {
return undefined
}
const headerValue = headers[trimmedHeader]
output[trimmedHeader] = Array.isArray(headerValue) ? headerValue.slice() : headerValue ?? null
}
return output
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @returns {boolean}
*/
function isInvalidOrWildcardVaryHeader (varyHeader) {
return hasVaryStar(varyHeader) || parseVaryHeader(varyHeader, {}) === undefined
}
/**
* Note: this deviates from the spec a little. Empty etags ("", W/"") are valid,
* however, including them in cached resposnes serves little to no purpose.
@@ -366,7 +625,7 @@ function assertCacheMethods (methods, name = 'CacheMethods') {
}
for (const method of methods) {
if (!safeHTTPMethods.includes(method)) {
if (!arrayIncludes(safeHTTPMethods, method)) {
throw new TypeError(`element of ${name}-array needs to be one of following values: ${safeHTTPMethods.join(', ')}, got ${method}`)
}
}
@@ -406,7 +665,10 @@ module.exports = {
assertCacheKey,
assertCacheValue,
parseCacheControlHeader,
hasInvalidCacheControlDirective,
parseVaryHeader,
hasVaryStar,
isInvalidOrWildcardVaryHeader,
isEtagUsable,
assertCacheMethods,
assertCacheStore,
+23 -6
View File
@@ -18,6 +18,26 @@ function parseHttpDate (date) {
}
}
function makeDate (year, monthIdx, day, hour, minute, second, weekday) {
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second))
// Date.UTC treats years 0-99 as 1900-1999. Reset the full year so component
// checks below validate the HTTP date as written.
if (year >= 0 && year <= 99) {
result.setUTCFullYear(year)
}
return result.getUTCFullYear() === year &&
result.getUTCMonth() === monthIdx &&
result.getUTCDate() === day &&
result.getUTCHours() === hour &&
result.getUTCMinutes() === minute &&
result.getUTCSeconds() === second &&
result.getUTCDay() === weekday
? result
: undefined
}
/**
* @see https://httpwg.org/specs/rfc9110.html#preferred.date.format
*
@@ -224,8 +244,7 @@ function parseImfDate (date) {
second = (code1 - 48) * 10 + (code2 - 48) // Convert ASCII codes to number
}
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second))
return result.getUTCDay() === weekday ? result : undefined
return makeDate(year, monthIdx, day, hour, minute, second, weekday)
}
/**
@@ -429,8 +448,7 @@ function parseAscTimeDate (date) {
}
const year = (yearDigit1 - 48) * 1000 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48)
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second))
return result.getUTCDay() === weekday ? result : undefined
return makeDate(year, monthIdx, day, hour, minute, second, weekday)
}
/**
@@ -644,8 +662,7 @@ function parseRfc850Date (date) {
second = (code1 - 48) * 10 + (code2 - 48) // Convert ASCII codes to number
}
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second))
return result.getUTCDay() === weekday ? result : undefined
return makeDate(year, monthIdx, day, hour, minute, second, weekday)
}
module.exports = {
+79 -9
View File
@@ -105,7 +105,7 @@ function validateCookiePath (path) {
if (
code < 0x20 || // exclude CTLs (0-31)
code === 0x7F || // DEL
code > 0x7E || // exclude DEL and non-ascii
code === 0x3B // ;
) {
throw new Error('Invalid cookie path')
@@ -114,16 +114,80 @@ function validateCookiePath (path) {
}
/**
* I have no idea why these values aren't allowed to be honest,
* but Deno tests these. - Khafra
* <let-dig> ::= <letter> | <digit>
*
* <letter> ::= any one of the 52 alphabetic characters A through Z in
* upper case and a through z in lower case
*
* <digit> ::= any one of the ten digits 0 through 9r
*
* @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
* @param {number} code
*/
function isLetterOrDigit (code) {
return (
(code >= 0x30 && code <= 0x39) || // 0-9
(code >= 0x41 && code <= 0x5A) || // A-Z
(code >= 0x61 && code <= 0x7A) // a-z
)
}
/**
* Validates a cookie domain against the "preferred name syntax".
*
* <domain> ::= <subdomain> | " "
* <subdomain> ::= <label> | <subdomain> "." <label>
* <label> ::= <let-dig> [ [ <ldh-str> ] <let-dig> ]
* <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
* <let-dig-hyp> ::= <let-dig> | "-"
*
* @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
* @see https://www.rfc-editor.org/rfc/rfc1123#section-2.1
* @see https://www.rfc-editor.org/rfc/rfc1035#section-2.3.4
* @param {string} domain
*/
function validateCookieDomain (domain) {
if (
domain.startsWith('-') ||
domain.endsWith('.') ||
domain.endsWith('-')
) {
// <domain> ::= <subdomain> | " "
if (domain === ' ') {
return
}
if (domain.length > 255) {
throw new Error('Invalid cookie domain')
}
let labelLength = 0
for (let i = 0; i < domain.length; ++i) {
const code = domain.charCodeAt(i)
if (code === 0x2E) {
if (labelLength === 0) {
throw new Error('Invalid cookie domain')
}
if (domain.charCodeAt(i - 1) === 0x2D) { // "-"
throw new Error('Invalid cookie domain')
}
labelLength = 0
continue
}
if (labelLength === 0 && !isLetterOrDigit(code)) {
throw new Error('Invalid cookie domain')
}
if (!isLetterOrDigit(code) && code !== 0x2D) { // "-"
throw new Error('Invalid cookie domain')
}
if (++labelLength > 63) {
throw new Error('Invalid cookie domain')
}
}
if (labelLength === 0 || domain.charCodeAt(domain.length - 1) === 0x2D) { // "-"
throw new Error('Invalid cookie domain')
}
}
@@ -266,7 +330,13 @@ function stringify (cookie) {
const [key, ...value] = part.split('=')
out.push(`${key.trim()}=${value.join('=')}`)
const trimmedKey = key.trim()
const joinedValue = value.join('=')
validateCookieName(trimmedKey)
validateCookieValue(joinedValue)
out.push(`${trimmedKey}=${joinedValue}`)
}
return out.join('; ')
+235 -220
View File
@@ -1,12 +1,12 @@
{
"name": "undici",
"version": "7.28.0",
"version": "7.29.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "undici",
"version": "7.28.0",
"version": "7.29.0",
"license": "MIT",
"devDependencies": {
"@fastify/busboy": "3.2.0",
@@ -1065,9 +1065,9 @@
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
"integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz",
"integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1148,9 +1148,9 @@
}
},
"node_modules/@eslint/eslintrc": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz",
"integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==",
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.6.tgz",
"integrity": "sha512-l2Ul9PrHsPCKcEY/ac7VgFj9D80C7S68sOKc618SyHDPK36s1XcFebXY0iTzUVn4Yq+YbwvSnDmCz9yxjX+QrA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1160,7 +1160,7 @@
"globals": "^14.0.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.1",
"js-yaml": "^4.3.0",
"minimatch": "^3.1.5",
"strip-json-comments": "^3.1.1"
},
@@ -1172,9 +1172,9 @@
}
},
"node_modules/@eslint/js": {
"version": "9.39.4",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz",
"integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==",
"version": "9.39.5",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.5.tgz",
"integrity": "sha512-QywQuszQh77pIXCsq998c8hbhSTI/azTty1Z6N53dmAudKHhy573j3yvRLsX2BSp8YpLtoCEG8E9DJe+8zUh4A==",
"dev": true,
"license": "MIT",
"engines": {
@@ -1352,9 +1352,9 @@
}
},
"node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": {
"version": "3.14.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz",
"integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1874,14 +1874,14 @@
}
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.5.tgz",
"integrity": "sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==",
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
"integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@tybys/wasm-util": "^0.10.2"
"@tybys/wasm-util": "^0.10.3"
},
"funding": {
"type": "github",
@@ -1940,13 +1940,6 @@
"node": ">=12.4.0"
}
},
"node_modules/@package-json/types": {
"version": "0.0.12",
"resolved": "https://registry.npmjs.org/@package-json/types/-/types-0.0.12.tgz",
"integrity": "sha512-uu43FGU34B5VM9mCNjXCwLaGHYjXdNincqKLaraaCW+7S2+SmiBg1Nv8bPnmschrIfZmfKNY9f3fC376MRrObw==",
"dev": true,
"license": "MIT"
},
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@@ -1990,9 +1983,9 @@
"license": "MIT"
},
"node_modules/@sinclair/typebox": {
"version": "0.34.49",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.49.tgz",
"integrity": "sha512-brySQQs7Jtn0joV8Xh9ZV/hZb9Ozb0pmazDIASBkYKCjXrXU3mpcFahmK/z4YDhGkQvP9mWJbVyahdtU5wQA+A==",
"version": "0.34.52",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.52.tgz",
"integrity": "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw==",
"dev": true,
"license": "MIT"
},
@@ -2060,9 +2053,9 @@
}
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
"integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==",
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
"integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -2216,17 +2209,17 @@
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.61.0.tgz",
"integrity": "sha512-bFNvl9ZczlVb+wR2Akszf3gHfKVj/8WanXaGJ3UstTA7brNKg0cNdk6X1Psu5V7MZ2oQtzZKOEzIUehaoxbDGw==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.65.0.tgz",
"integrity": "sha512-IEgob78X12rHpUmtcwFsXhZdVGJtwTVP8FiCLZkR6GlYVrl2PcuB+KhCE5BlVC/eQpQnu8WXRtkHZuPar+gCRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.61.0",
"@typescript-eslint/type-utils": "8.61.0",
"@typescript-eslint/utils": "8.61.0",
"@typescript-eslint/visitor-keys": "8.61.0",
"@typescript-eslint/scope-manager": "8.65.0",
"@typescript-eslint/type-utils": "8.65.0",
"@typescript-eslint/utils": "8.65.0",
"@typescript-eslint/visitor-keys": "8.65.0",
"ignore": "^7.0.5",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0"
@@ -2239,15 +2232,15 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^8.61.0",
"@typescript-eslint/parser": "^8.65.0",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz",
"integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -2255,16 +2248,16 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.61.0.tgz",
"integrity": "sha512-5B7PfA2e1NQGCnDHd/0lW7W3gvp3d59Ryw54FYO8Uswxo9f6ikw3AZV+Xj/TvpImmpsiYyUqAfhC6kJID1jF6w==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.65.0.tgz",
"integrity": "sha512-CZ4nMxWwgu1HEEFNkeaCptra9QCtkmKdgf3sWh1rl1trIhmxLilgTV4cwcbQ4wemnT4sWQN8CaKOmdYx+g2gMA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/scope-manager": "8.61.0",
"@typescript-eslint/types": "8.61.0",
"@typescript-eslint/typescript-estree": "8.61.0",
"@typescript-eslint/visitor-keys": "8.61.0",
"@typescript-eslint/scope-manager": "8.65.0",
"@typescript-eslint/types": "8.65.0",
"@typescript-eslint/typescript-estree": "8.65.0",
"@typescript-eslint/visitor-keys": "8.65.0",
"debug": "^4.4.3"
},
"engines": {
@@ -2280,14 +2273,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.61.0.tgz",
"integrity": "sha512-DV42F7MLJO6Rax7SK1yg43tcnEfGUrurSpSxKuVX+a3RCTzBlH3fuxprrOJXKCJGAaw82xXocikJ0uQaqwXgGA==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.65.0.tgz",
"integrity": "sha512-SxnPhbTsGahizDgbu7oqFH/xVtzIqMd/s+WtnSxNxJZJpLbdT5IPdzg8EZxO3+PoKahXmwJLeNQOpKJb3/bi7Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.61.0",
"@typescript-eslint/types": "^8.61.0",
"@typescript-eslint/tsconfig-utils": "^8.65.0",
"@typescript-eslint/types": "^8.65.0",
"debug": "^4.4.3"
},
"engines": {
@@ -2302,14 +2295,14 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.61.0.tgz",
"integrity": "sha512-IWdXFHFSb6mlC3HPc7QsLDm5zYEbUla6trDEHf32D3/dnuUyXd87plScSNXSbm0/RxMvObpI17sv/EDTGrGZkA==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.65.0.tgz",
"integrity": "sha512-Esbl8OSYiVxBokYgWPf7VVWg/BE798wXhimnn9ML9Pt5qoDf8bfQlgjlKXR/k98+AcNzlLKYrpCcrcuZ9DZLgg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.61.0",
"@typescript-eslint/visitor-keys": "8.61.0"
"@typescript-eslint/types": "8.65.0",
"@typescript-eslint/visitor-keys": "8.65.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -2320,9 +2313,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.61.0.tgz",
"integrity": "sha512-O5Amvdv9ztMpxpf+vmFULGG78IE6Qwdr3bCGvqwG4nwc9H2qXkOYJJnRbRHyMkQTjv1d03olqwwwzHLMqpFePQ==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.65.0.tgz",
"integrity": "sha512-j6GzGqCiRdA7Qhur2VVmKZAkBLfnHFQfx4TaJGL9RMveZqCo48jSHHO0DTgizEnGhtWnqmbtCUSrqSkdiY/0Hg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -2337,15 +2330,15 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.61.0.tgz",
"integrity": "sha512-TuBiQYIkd97yBfInHCTKVYMbX4kvEmpOEuixIuzCU9p8BGT1SfyyO0d0IfDMbPIHcjn/hWnusUX5e8v5Xg+X8A==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.65.0.tgz",
"integrity": "sha512-YjaZ7PRI5qY7ax2L3PbvX0rRyGtipAReCWs0mhhDBHjH/vl0g0BonaGXrKdKpMbIIsMIwDgbk/xzkBTyAltS5g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.61.0",
"@typescript-eslint/typescript-estree": "8.61.0",
"@typescript-eslint/utils": "8.61.0",
"@typescript-eslint/types": "8.65.0",
"@typescript-eslint/typescript-estree": "8.65.0",
"@typescript-eslint/utils": "8.65.0",
"debug": "^4.4.3",
"ts-api-utils": "^2.5.0"
},
@@ -2362,9 +2355,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.61.0.tgz",
"integrity": "sha512-9QTQpZ5Iin4CdIodfbDQFSeiSJKidgYJYug1P9CC2xWgUTvlmixViqDZNciMjwLBZyJnG4tGmPl97rVAFb1AJg==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.65.0.tgz",
"integrity": "sha512-JSSwWNy+H0E/01jJEM+hrX6N0OFDzFzeIhHFSAS01tlVaevpG8cFyYRPhS5yjGOvBUx3sqQHVMjCL1CAZZMxBg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -2376,16 +2369,16 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.61.0.tgz",
"integrity": "sha512-42zatd5qSvvcV1JdDBCLxYRznvP4eIHpPoZXdkPFnAmanA4FuZ5dibSnCBggY8hQnqajPpoGjXFdZ7fIJKQnlA==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.65.0.tgz",
"integrity": "sha512-JboAE2swaYt4tb1fHhHTABE2K+OLy09XfcTbhnk4Pw96f9dd2e9iYsJ28gBggHlo5z5x1rkyWvcPoTuNTd4oGg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.61.0",
"@typescript-eslint/tsconfig-utils": "8.61.0",
"@typescript-eslint/types": "8.61.0",
"@typescript-eslint/visitor-keys": "8.61.0",
"@typescript-eslint/project-service": "8.65.0",
"@typescript-eslint/tsconfig-utils": "8.65.0",
"@typescript-eslint/types": "8.65.0",
"@typescript-eslint/visitor-keys": "8.65.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
@@ -2414,16 +2407,16 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
"integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"engines": {
"node": "18 || 20 || >=22"
"node": "20 || >=22"
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
@@ -2443,9 +2436,9 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -2456,16 +2449,16 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.61.0.tgz",
"integrity": "sha512-3bzFt7ImFMW/jVYwJamDoe/dMOdFLSC6pom6rRjdh4SZJEYupyMzem8e7vKZLclLfpHjlwSAXOUxtKxGXUiLqA==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.65.0.tgz",
"integrity": "sha512-gXiwIHsYreboxeJucHKPvgwl7dXt50mF8s1/c00cP/WoVTyWKFdtfhRWwZiXYFU5H2O8vVoSLNrexFZjYS/SGA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.61.0",
"@typescript-eslint/types": "8.61.0",
"@typescript-eslint/typescript-estree": "8.61.0"
"@typescript-eslint/scope-manager": "8.65.0",
"@typescript-eslint/types": "8.65.0",
"@typescript-eslint/typescript-estree": "8.65.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -2480,13 +2473,13 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.61.0.tgz",
"integrity": "sha512-QVLZu3ZPQEE+HICQyAMZ2yLQhxf0meY/wx6Hx14YcTNj13JB3qHlX3lJ02L3fLGHgERRH71kvYDwiXIguT3AjQ==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.65.0.tgz",
"integrity": "sha512-8C71BQkGjiMmXtop7pHVJu1l2NNShFdkCyD6a2ezzs5vU/L3LRtb69EtcteFwz0mYMPzIgOw0n6OV4VBUWZd7A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.61.0",
"@typescript-eslint/types": "8.65.0",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
@@ -2511,9 +2504,9 @@
}
},
"node_modules/@ungap/structured-clone": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz",
"integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.3.tgz",
"integrity": "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg==",
"dev": true,
"license": "ISC"
},
@@ -3434,9 +3427,9 @@
"license": "MIT"
},
"node_modules/baseline-browser-mapping": {
"version": "2.10.37",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.37.tgz",
"integrity": "sha512-girxaJ7WZssDOFhzCGZTDKoTa1gk6A1TbflaYTpykLJ4UU9Fz9kx1aREM8JCuoVHbL8X8T/mJg7w2oYSq72Oig==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.1.tgz",
"integrity": "sha512-HYXq73DDpCtNzOmrFsm9eSwCvWCql0RzqjpDzXN9EadiLJ4DNat0nsZ/Bzmy+Ud12mb4/zKDY0cQ805ZzN+i0A==",
"dev": true,
"license": "Apache-2.0",
"bin": {
@@ -3471,9 +3464,9 @@
}
},
"node_modules/brace-expansion": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
"version": "1.1.16",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz",
"integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3495,9 +3488,9 @@
}
},
"node_modules/browserslist": {
"version": "4.28.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz",
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==",
"version": "4.28.7",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.7.tgz",
"integrity": "sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw==",
"dev": true,
"funding": [
{
@@ -3515,10 +3508,10 @@
],
"license": "MIT",
"dependencies": {
"baseline-browser-mapping": "^2.10.12",
"caniuse-lite": "^1.0.30001782",
"electron-to-chromium": "^1.5.328",
"node-releases": "^2.0.36",
"baseline-browser-mapping": "^2.10.44",
"caniuse-lite": "^1.0.30001806",
"electron-to-chromium": "^1.5.393",
"node-releases": "^2.0.51",
"update-browserslist-db": "^1.2.3"
},
"bin": {
@@ -3727,9 +3720,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001799",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz",
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==",
"version": "1.0.30001806",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001806.tgz",
"integrity": "sha512-72Cuvd95zbSYPKq6Fhg8eDJRlzgWDf7/mtoZv6Qe/DYNCEBdNxoA3+rZAU2ZhGCpZlns3EssFavaZomckT5Uuw==",
"dev": true,
"funding": [
{
@@ -4229,9 +4222,9 @@
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.372",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.372.tgz",
"integrity": "sha512-M3yhbAlilnwqC8D21t28UCDGHyitShTmmLRU/H+b74P6Ski16Nb9HONYEaVpMj/pwC7BEo5B95FpjODLCWbtfA==",
"version": "1.5.396",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.396.tgz",
"integrity": "sha512-yHiw2Y3C3H9U6TMbOfoWK/BPreiOPXRfTWPBwQBoZG6/8TB6eOPnsy5oaRYuatR7Fw2SJ4kKforgufeo7fq0EQ==",
"dev": true,
"license": "ISC"
},
@@ -4256,9 +4249,9 @@
"license": "MIT"
},
"node_modules/enhanced-resolve": {
"version": "5.24.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.0.tgz",
"integrity": "sha512-SkE2t82KlkkxQRVMVLAGKxLfORGQfrkx5dkj+vlgXRVNEdPc4eZcR+J/Fvj8C+yKSFH5L0q3NFlyufOVQnCcYQ==",
"version": "5.24.3",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.3.tgz",
"integrity": "sha512-PwKooW9JUzh5chmYfHM3IQl5OkK2u2Nm011MgeZrss3JmFraUx/fqrf78kk8GUMYoibx/14MdwTl/1WKkG7TpQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4348,6 +4341,25 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/es-abstract-get": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-abstract-get/-/es-abstract-get-1.0.0.tgz",
"integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.2",
"is-callable": "^1.2.7",
"object-inspect": "^1.13.4"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
@@ -4369,9 +4381,9 @@
}
},
"node_modules/es-iterator-helpers": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.3.3.tgz",
"integrity": "sha512-0PuBxFi+4uPanB97iDxCLWuHeYud2FALrw5HFZGtAF38UpJDbDC8frwp2cnDyae692CQ0dou60UwWfhgsa4U/g==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.4.0.tgz",
"integrity": "sha512-c/A0P0oxkACDc+cKWw8evLXK83oBKgn0qPOqCYT4x9uolpCIJAcYvJC9QYKNDRPsTeGyCrQ326jrvgZWdCdK5Q==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4439,15 +4451,18 @@
}
},
"node_modules/es-to-primitive": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz",
"integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==",
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.4.tgz",
"integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-abstract-get": "^1.0.0",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"is-callable": "^1.2.7",
"is-date-object": "^1.0.5",
"is-symbol": "^1.0.4"
"is-date-object": "^1.1.0",
"is-symbol": "^1.1.1"
},
"engines": {
"node": ">= 0.4"
@@ -4522,9 +4537,9 @@
}
},
"node_modules/eslint": {
"version": "9.39.4",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz",
"integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==",
"version": "9.39.5",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.5.tgz",
"integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4533,8 +4548,8 @@
"@eslint/config-array": "^0.21.2",
"@eslint/config-helpers": "^0.4.2",
"@eslint/core": "^0.17.0",
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "9.39.4",
"@eslint/eslintrc": "^3.3.6",
"@eslint/js": "9.39.5",
"@eslint/plugin-kit": "^0.4.1",
"@humanfs/node": "^0.16.6",
"@humanwhocodes/module-importer": "^1.0.1",
@@ -4598,9 +4613,9 @@
}
},
"node_modules/eslint-compat-utils/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -4761,13 +4776,12 @@
}
},
"node_modules/eslint-plugin-import-x": {
"version": "4.16.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.16.2.tgz",
"integrity": "sha512-rM9K8UBHcWKpzQzStn1YRN2T5NvdeIfSVoKu/lKF41znQXHAUcBbYXe5wd6GNjZjTrP7viQ49n1D83x/2gYgIw==",
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.17.1.tgz",
"integrity": "sha512-4cdstYkKCyjumM2Q9NSI03K8D2a9F4Ssz33K2lv2hQa4KmR9jPLwk3uWGtNvclfqBrPGfGuMBwsGMbe6dMRbfg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@package-json/types": "^0.0.12",
"@typescript-eslint/types": "^8.56.0",
"comment-parser": "^1.4.1",
"debug": "^4.4.1",
@@ -4809,16 +4823,16 @@
}
},
"node_modules/eslint-plugin-import-x/node_modules/brace-expansion": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
"integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"engines": {
"node": "18 || 20 || >=22"
"node": "20 || >=22"
}
},
"node_modules/eslint-plugin-import-x/node_modules/minimatch": {
@@ -4838,9 +4852,9 @@
}
},
"node_modules/eslint-plugin-import-x/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -4891,9 +4905,9 @@
}
},
"node_modules/eslint-plugin-n/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -5195,9 +5209,9 @@
}
},
"node_modules/fast-check": {
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.8.0.tgz",
"integrity": "sha512-GOJ158CUMnN6cSahsv4+ExARvIDuzzinFjkp0E9WtiBa5zcVeLozVkWaE4IzFcc+Y48Wp1EDlUZsXRyAztQcSg==",
"version": "4.9.0",
"resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.9.0.tgz",
"integrity": "sha512-7ms6T7SybUev/PQITciI0yLM2pOSFy5zpG8Ty7tQofcVaQUvrMXp6CBwqF6fThLCLOrfBtuHAtwq6Yu4XPCllg==",
"dev": true,
"funding": [
{
@@ -5381,9 +5395,9 @@
}
},
"node_modules/flatted": {
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
"integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.3.tgz",
"integrity": "sha512-/zipXxyO6rGvuNGDiULY9MvEGSkb2gaG4GGH4ygMi0ZZzyMHdUZBmntJmx5x1G2VuPytCwGN4xsJP6cw+sK+vQ==",
"dev": true,
"license": "ISC"
},
@@ -5649,9 +5663,9 @@
}
},
"node_modules/glob/node_modules/brace-expansion": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",
"integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.2.tgz",
"integrity": "sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -6122,9 +6136,9 @@
}
},
"node_modules/is-bun-module/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -6572,9 +6586,9 @@
}
},
"node_modules/istanbul-lib-instrument/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -7258,9 +7272,9 @@
}
},
"node_modules/jest-snapshot/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -7380,9 +7394,9 @@
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz",
"integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==",
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
"dev": true,
"funding": [
{
@@ -7632,9 +7646,9 @@
}
},
"node_modules/make-dir/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -7981,9 +7995,9 @@
}
},
"node_modules/node-exports-info": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.0.tgz",
"integrity": "sha512-pyFS63ptit/P5WqUkt+UUfe+4oevH+bFeIiPPdfb0pFeYEu/1ELnJu5l+5EcTKYL5M7zaAa7S8ddywgXypqKCw==",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz",
"integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -8017,9 +8031,9 @@
"license": "MIT"
},
"node_modules/node-releases": {
"version": "2.0.47",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz",
"integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==",
"version": "2.0.51",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz",
"integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -8043,9 +8057,9 @@
}
},
"node_modules/normalize-package-data/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -8261,13 +8275,14 @@
}
},
"node_modules/own-keys": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz",
"integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.2.tgz",
"integrity": "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==",
"dev": true,
"license": "MIT",
"dependencies": {
"get-intrinsic": "^1.2.6",
"call-bound": "^1.0.4",
"get-intrinsic": "^1.3.0",
"object-keys": "^1.1.1",
"safe-push-apply": "^1.0.0"
},
@@ -8491,9 +8506,9 @@
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
"dev": true,
"license": "MIT",
"engines": {
@@ -8714,9 +8729,9 @@
}
},
"node_modules/pure-rand": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-8.4.0.tgz",
"integrity": "sha512-IoM8YF/jY0hiugFo/wOWqfmarlE6J0wc6fDK1PhftMk7MGhVZl88sZimmqBBFomLOCSmcCCpsfj7wXASCpvK9A==",
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-8.4.2.tgz",
"integrity": "sha512-vvuOGgcuPJAirlHvuQw1TrOiw7ptaIXXmIbNuiNOY6lNGJJH49PQ1Kj4nd783nPdQhQdicgOjVI2yI/9BD6/Ng==",
"dev": true,
"funding": [
{
@@ -8778,9 +8793,9 @@
},
"node_modules/react-is-19": {
"name": "react-is",
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.7.tgz",
"integrity": "sha512-kZFnouyVv7eP/Phmrlo9FK+zcAdriZJvzxXHF1Sl1P377WSGe2G/JxVolhTrB/jeV47lKImhNUsijjHAAbcl/A==",
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz",
"integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==",
"dev": true,
"license": "MIT"
},
@@ -9878,16 +9893,16 @@
}
},
"node_modules/test-exclude/node_modules/brace-expansion": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
"integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"engines": {
"node": "18 || 20 || >=22"
"node": "20 || >=22"
}
},
"node_modules/test-exclude/node_modules/minimatch": {
@@ -10025,9 +10040,9 @@
}
},
"node_modules/tsd/node_modules/@sinclair/typebox": {
"version": "0.27.10",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz",
"integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==",
"version": "0.27.12",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.12.tgz",
"integrity": "sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g==",
"dev": true,
"license": "MIT"
},
@@ -10239,16 +10254,16 @@
}
},
"node_modules/typescript-eslint": {
"version": "8.61.0",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.61.0.tgz",
"integrity": "sha512-8y31Rd0eGTrDKqhy6vT0HtzhN+YLjQizwX3aA3hPXP/ynSfnrBXcQY5IzsP9/DM7+klX4IUncZZjkchP0z+rUw==",
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.65.0.tgz",
"integrity": "sha512-/ggrHAwyjENDusvyxbuqxAC2dTnZg/Z8F+fgQtYIz+L6n/9HfSlEZcFGV/NsMNa6CkGk0xUjUAFwC0vHOflvIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "8.61.0",
"@typescript-eslint/parser": "8.61.0",
"@typescript-eslint/typescript-estree": "8.61.0",
"@typescript-eslint/utils": "8.61.0"
"@typescript-eslint/eslint-plugin": "8.65.0",
"@typescript-eslint/parser": "8.65.0",
"@typescript-eslint/typescript-estree": "8.65.0",
"@typescript-eslint/utils": "8.65.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -10282,9 +10297,9 @@
}
},
"node_modules/undici": {
"version": "6.27.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz",
"integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==",
"version": "6.28.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz",
"integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -10658,9 +10673,9 @@
}
},
"node_modules/ws": {
"version": "8.21.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
"integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
"version": "8.21.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.1.tgz",
"integrity": "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -10713,9 +10728,9 @@
}
},
"node_modules/yargs": {
"version": "17.7.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
"version": "17.7.3",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz",
"integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==",
"dev": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "undici",
"version": "7.28.0",
"version": "7.29.0",
"description": "An HTTP/1.1 client, written from scratch for Node.js",
"homepage": "https://undici.nodejs.org",
"bugs": {
+19 -3
View File
@@ -3161,7 +3161,11 @@ var require_request = __commonJS({
} else if (typeof val[i] === "object") {
throw new InvalidArgumentError(`invalid ${key} header`);
} else {
arr.push(`${val[i]}`);
const str = `${val[i]}`;
if (!isValidHeaderValue(str)) {
throw new InvalidArgumentError(`invalid ${key} header`);
}
arr.push(str);
}
}
val = arr;
@@ -3173,6 +3177,9 @@ var require_request = __commonJS({
val = "";
} else {
val = `${val}`;
if (!isValidHeaderValue(val)) {
throw new InvalidArgumentError(`invalid ${key} header`);
}
}
if (headerName === "host") {
if (request.host !== null) {
@@ -7088,6 +7095,7 @@ var require_client_h1 = __commonJS({
RequestContentLengthMismatchError,
ResponseContentLengthMismatchError,
RequestAbortedError,
InvalidArgumentError,
HeadersTimeoutError,
HeadersOverflowError,
SocketError,
@@ -7948,8 +7956,16 @@ var require_client_h1 = __commonJS({
}
body = bodyStream.stream;
contentLength = bodyStream.length;
} else if (util.isBlobLike(body) && request.contentType == null && body.type) {
headers.push("content-type", body.type);
} else if (util.isBlobLike(body) && request.contentType == null) {
const contentType = body.type;
if (contentType) {
const contentTypeValue = `${contentType}`;
if (!util.isValidHeaderValue(contentTypeValue)) {
util.errorRequest(client, request, new InvalidArgumentError("invalid content-type header"));
return false;
}
headers.push("content-type", contentTypeValue);
}
}
if (body && typeof body.read === "function") {
body.read(0);
+1 -1
View File
@@ -2,5 +2,5 @@
// Refer to tools/dep_updaters/update-undici.sh
#ifndef SRC_UNDICI_VERSION_H_
#define SRC_UNDICI_VERSION_H_
#define UNDICI_VERSION "7.28.0"
#define UNDICI_VERSION "7.29.0"
#endif // SRC_UNDICI_VERSION_H_