Skip to content

Commit

Permalink
deps: update undici to 6.21.0
Browse files Browse the repository at this point in the history
PR-URL: #55851
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
  • Loading branch information
nodejs-github-bot authored and RafaelGSS committed Nov 18, 2024
1 parent e0ef65b commit dc8aca3
Show file tree
Hide file tree
Showing 19 changed files with 147 additions and 201 deletions.
5 changes: 5 additions & 0 deletions deps/undici/src/lib/core/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ const setupConnectTimeout = process.platform === 'win32'
* @param {number} opts.port
*/
function onConnectTimeout (socket, opts) {
// The socket could be already garbage collected
if (socket == null) {
return
}

let message = 'Connect Timeout Error'
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`
Expand Down
6 changes: 3 additions & 3 deletions deps/undici/src/lib/handler/retry-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class RetryHandler {
return false
}

const { start, size, end = size } = contentRange
const { start, size, end = size - 1 } = contentRange

assert(this.start === start, 'content-range mismatch')
assert(this.end == null || this.end === end, 'content-range mismatch')
Expand All @@ -252,7 +252,7 @@ class RetryHandler {
)
}

const { start, size, end = size } = range
const { start, size, end = size - 1 } = range
assert(
start != null && Number.isFinite(start),
'content-range mismatch'
Expand All @@ -266,7 +266,7 @@ class RetryHandler {
// We make our best to checkpoint the body for further range headers
if (this.end == null) {
const contentLength = headers['content-length']
this.end = contentLength != null ? Number(contentLength) : null
this.end = contentLength != null ? Number(contentLength) - 1 : null
}

assert(Number.isFinite(this.start))
Expand Down
4 changes: 2 additions & 2 deletions deps/undici/src/lib/llhttp/wasm_build_env.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

> undici@6.20.1 prebuild:wasm
> undici@6.21.0 prebuild:wasm
> node build/wasm.js --prebuild

> docker build --platform=linux/x86_64 -t llhttp_wasm_builder -f /home/runner/work/node/node/deps/undici/src/build/Dockerfile /home/runner/work/node/node/deps/undici/src



> undici@6.20.1 build:wasm
> undici@6.21.0 build:wasm
> node build/wasm.js --docker

> docker run --rm -t --platform=linux/x86_64 --user 1001:127 --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/lib/llhttp,target=/home/node/undici/lib/llhttp llhttp_wasm_builder node build/wasm.js
Expand Down
1 change: 1 addition & 0 deletions deps/undici/src/lib/web/cache/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Cache {
webidl.illegalConstructor()
}

webidl.util.markAsUncloneable(this)
this.#relevantRequestResponseList = arguments[1]
}

Expand Down
2 changes: 2 additions & 0 deletions deps/undici/src/lib/web/cache/cachestorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class CacheStorage {
if (arguments[0] !== kConstruct) {
webidl.illegalConstructor()
}

webidl.util.markAsUncloneable(this)
}

async match (request, options = {}) {
Expand Down
2 changes: 2 additions & 0 deletions deps/undici/src/lib/web/eventsource/eventsource.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class EventSource extends EventTarget {
// 1. Let ev be a new EventSource object.
super()

webidl.util.markAsUncloneable(this)

const prefix = 'EventSource constructor'
webidl.argumentLengthCheck(arguments, 1, prefix)

Expand Down
2 changes: 2 additions & 0 deletions deps/undici/src/lib/web/fetch/formdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const File = globalThis.File ?? NativeFile
// https://xhr.spec.whatwg.org/#formdata
class FormData {
constructor (form) {
webidl.util.markAsUncloneable(this)

if (form !== undefined) {
throw webidl.errors.conversionFailed({
prefix: 'FormData constructor',
Expand Down
2 changes: 2 additions & 0 deletions deps/undici/src/lib/web/fetch/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ class Headers {
#headersList

constructor (init = undefined) {
webidl.util.markAsUncloneable(this)

if (init === kConstruct) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/lib/web/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ async function httpNetworkFetch (

// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
if (codings.length !== 0 && request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
for (let i = 0; i < codings.length; ++i) {
for (let i = codings.length - 1; i >= 0; --i) {
const coding = codings[i]
// https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
if (coding === 'x-gzip' || coding === 'gzip') {
Expand Down
1 change: 1 addition & 0 deletions deps/undici/src/lib/web/fetch/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ let patchMethodWarning = false
class Request {
// https://fetch.spec.whatwg.org/#dom-request
constructor (input, init = {}) {
webidl.util.markAsUncloneable(this)
if (input === kConstruct) {
return
}
Expand Down
1 change: 1 addition & 0 deletions deps/undici/src/lib/web/fetch/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class Response {

// https://fetch.spec.whatwg.org/#dom-response
constructor (body = null, init = {}) {
webidl.util.markAsUncloneable(this)
if (body === kConstruct) {
return
}
Expand Down
2 changes: 2 additions & 0 deletions deps/undici/src/lib/web/fetch/webidl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const { types, inspect } = require('node:util')
const { markAsUncloneable } = require('node:worker_threads')
const { toUSVString } = require('../../core/util')

/** @type {import('../../../types/webidl').Webidl} */
Expand Down Expand Up @@ -86,6 +87,7 @@ webidl.util.Type = function (V) {
}
}

webidl.util.markAsUncloneable = markAsUncloneable || (() => {})
// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
webidl.util.ConvertToInt = function (V, bitLength, signedness, opts) {
let upperBound
Expand Down
4 changes: 4 additions & 0 deletions deps/undici/src/lib/web/websocket/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MessageEvent extends Event {
constructor (type, eventInitDict = {}) {
if (type === kConstruct) {
super(arguments[1], arguments[2])
webidl.util.markAsUncloneable(this)
return
}

Expand All @@ -26,6 +27,7 @@ class MessageEvent extends Event {
super(type, eventInitDict)

this.#eventInit = eventInitDict
webidl.util.markAsUncloneable(this)
}

get data () {
Expand Down Expand Up @@ -112,6 +114,7 @@ class CloseEvent extends Event {
super(type, eventInitDict)

this.#eventInit = eventInitDict
webidl.util.markAsUncloneable(this)
}

get wasClean () {
Expand Down Expand Up @@ -142,6 +145,7 @@ class ErrorEvent extends Event {
webidl.argumentLengthCheck(arguments, 1, prefix)

super(type, eventInitDict)
webidl.util.markAsUncloneable(this)

type = webidl.converters.DOMString(type, prefix, 'type')
eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {})
Expand Down
2 changes: 2 additions & 0 deletions deps/undici/src/lib/web/websocket/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class WebSocket extends EventTarget {
constructor (url, protocols = []) {
super()

webidl.util.markAsUncloneable(this)

const prefix = 'WebSocket constructor'
webidl.argumentLengthCheck(arguments, 1, prefix)

Expand Down
Loading

0 comments on commit dc8aca3

Please sign in to comment.