Skip to content

Commit dc8aca3

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update undici to 6.21.0
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>
1 parent e0ef65b commit dc8aca3

19 files changed

+147
-201
lines changed

deps/undici/src/lib/core/connect.js

+5
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ const setupConnectTimeout = process.platform === 'win32'
220220
* @param {number} opts.port
221221
*/
222222
function onConnectTimeout (socket, opts) {
223+
// The socket could be already garbage collected
224+
if (socket == null) {
225+
return
226+
}
227+
223228
let message = 'Connect Timeout Error'
224229
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
225230
message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`

deps/undici/src/lib/handler/retry-handler.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class RetryHandler {
229229
return false
230230
}
231231

232-
const { start, size, end = size } = contentRange
232+
const { start, size, end = size - 1 } = contentRange
233233

234234
assert(this.start === start, 'content-range mismatch')
235235
assert(this.end == null || this.end === end, 'content-range mismatch')
@@ -252,7 +252,7 @@ class RetryHandler {
252252
)
253253
}
254254

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

272272
assert(Number.isFinite(this.start))

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

2-
> undici@6.20.1 prebuild:wasm
2+
> undici@6.21.0 prebuild:wasm
33
> node build/wasm.js --prebuild
44

55
> 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
66

77

88

9-
> undici@6.20.1 build:wasm
9+
> undici@6.21.0 build:wasm
1010
> node build/wasm.js --docker
1111

1212
> 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

deps/undici/src/lib/web/cache/cache.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Cache {
3737
webidl.illegalConstructor()
3838
}
3939

40+
webidl.util.markAsUncloneable(this)
4041
this.#relevantRequestResponseList = arguments[1]
4142
}
4243

deps/undici/src/lib/web/cache/cachestorage.js

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class CacheStorage {
1616
if (arguments[0] !== kConstruct) {
1717
webidl.illegalConstructor()
1818
}
19+
20+
webidl.util.markAsUncloneable(this)
1921
}
2022

2123
async match (request, options = {}) {

deps/undici/src/lib/web/eventsource/eventsource.js

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class EventSource extends EventTarget {
105105
// 1. Let ev be a new EventSource object.
106106
super()
107107

108+
webidl.util.markAsUncloneable(this)
109+
108110
const prefix = 'EventSource constructor'
109111
webidl.argumentLengthCheck(arguments, 1, prefix)
110112

deps/undici/src/lib/web/fetch/formdata.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const File = globalThis.File ?? NativeFile
1414
// https://xhr.spec.whatwg.org/#formdata
1515
class FormData {
1616
constructor (form) {
17+
webidl.util.markAsUncloneable(this)
18+
1719
if (form !== undefined) {
1820
throw webidl.errors.conversionFailed({
1921
prefix: 'FormData constructor',

deps/undici/src/lib/web/fetch/headers.js

+2
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ class Headers {
359359
#headersList
360360

361361
constructor (init = undefined) {
362+
webidl.util.markAsUncloneable(this)
363+
362364
if (init === kConstruct) {
363365
return
364366
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ async function httpNetworkFetch (
21372137

21382138
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
21392139
if (codings.length !== 0 && request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
2140-
for (let i = 0; i < codings.length; ++i) {
2140+
for (let i = codings.length - 1; i >= 0; --i) {
21412141
const coding = codings[i]
21422142
// https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
21432143
if (coding === 'x-gzip' || coding === 'gzip') {

deps/undici/src/lib/web/fetch/request.js

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ let patchMethodWarning = false
8282
class Request {
8383
// https://fetch.spec.whatwg.org/#dom-request
8484
constructor (input, init = {}) {
85+
webidl.util.markAsUncloneable(this)
8586
if (input === kConstruct) {
8687
return
8788
}

deps/undici/src/lib/web/fetch/response.js

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class Response {
110110

111111
// https://fetch.spec.whatwg.org/#dom-response
112112
constructor (body = null, init = {}) {
113+
webidl.util.markAsUncloneable(this)
113114
if (body === kConstruct) {
114115
return
115116
}

deps/undici/src/lib/web/fetch/webidl.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

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

67
/** @type {import('../../../types/webidl').Webidl} */
@@ -86,6 +87,7 @@ webidl.util.Type = function (V) {
8687
}
8788
}
8889

90+
webidl.util.markAsUncloneable = markAsUncloneable || (() => {})
8991
// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
9092
webidl.util.ConvertToInt = function (V, bitLength, signedness, opts) {
9193
let upperBound

deps/undici/src/lib/web/websocket/events.js

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class MessageEvent extends Event {
1414
constructor (type, eventInitDict = {}) {
1515
if (type === kConstruct) {
1616
super(arguments[1], arguments[2])
17+
webidl.util.markAsUncloneable(this)
1718
return
1819
}
1920

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

2829
this.#eventInit = eventInitDict
30+
webidl.util.markAsUncloneable(this)
2931
}
3032

3133
get data () {
@@ -112,6 +114,7 @@ class CloseEvent extends Event {
112114
super(type, eventInitDict)
113115

114116
this.#eventInit = eventInitDict
117+
webidl.util.markAsUncloneable(this)
115118
}
116119

117120
get wasClean () {
@@ -142,6 +145,7 @@ class ErrorEvent extends Event {
142145
webidl.argumentLengthCheck(arguments, 1, prefix)
143146

144147
super(type, eventInitDict)
148+
webidl.util.markAsUncloneable(this)
145149

146150
type = webidl.converters.DOMString(type, prefix, 'type')
147151
eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {})

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

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class WebSocket extends EventTarget {
5151
constructor (url, protocols = []) {
5252
super()
5353

54+
webidl.util.markAsUncloneable(this)
55+
5456
const prefix = 'WebSocket constructor'
5557
webidl.argumentLengthCheck(arguments, 1, prefix)
5658

0 commit comments

Comments
 (0)