Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0b61823

Browse filesBrowse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update undici to 5.28.2
PR-URL: #51024 Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 2b46711 commit 0b61823
Copy full SHA for 0b61823

File tree

Expand file treeCollapse file tree

17 files changed

+231
-284
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

17 files changed

+231
-284
lines changed
Open diff view settings
Collapse file

‎deps/undici/src/lib/api/api-request.js‎

Copy file name to clipboardExpand all lines: deps/undici/src/lib/api/api-request.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,4 @@ function request (opts, callback) {
177177
}
178178

179179
module.exports = request
180+
module.exports.RequestHandler = RequestHandler
Collapse file

‎deps/undici/src/lib/api/readable.js‎

Copy file name to clipboardExpand all lines: deps/undici/src/lib/api/readable.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ module.exports = class BodyReadable extends Readable {
180180
this
181181
.on('close', function () {
182182
signalListenerCleanup()
183-
if (signal?.aborted) {
183+
if (signal && signal.aborted) {
184184
reject(signal.reason || Object.assign(new Error('The operation was aborted'), { name: 'AbortError' }))
185185
} else {
186186
resolve(null)
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict'
22

33
module.exports = {
4-
kConstruct: Symbol('constructable')
4+
kConstruct: require('../core/symbols').kConstruct
55
}
Collapse file

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

Copy file name to clipboardExpand all lines: deps/undici/src/lib/core/symbols.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ module.exports = {
5858
kHTTP1BuildRequest: Symbol('http1 build request'),
5959
kHTTP2CopyHeaders: Symbol('http2 copy headers'),
6060
kHTTPConnVersion: Symbol('http connection version'),
61-
kRetryHandlerDefaultRetry: Symbol('retry agent default retry')
61+
kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
62+
kConstruct: Symbol('constructable')
6263
}
Collapse file

‎deps/undici/src/lib/fetch/dataURL.js‎

Copy file name to clipboardExpand all lines: deps/undici/src/lib/fetch/dataURL.js
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,14 @@ function dataURLProcessor (dataURL) {
119119
* @param {boolean} excludeFragment
120120
*/
121121
function URLSerializer (url, excludeFragment = false) {
122-
const href = url.href
123-
124122
if (!excludeFragment) {
125-
return href
123+
return url.href
126124
}
127125

128-
const hash = href.lastIndexOf('#')
129-
if (hash === -1) {
130-
return href
131-
}
132-
return href.slice(0, hash)
126+
const href = url.href
127+
const hashLength = url.hash.length
128+
129+
return hashLength === 0 ? href : href.substring(0, href.length - hashLength)
133130
}
134131

135132
// https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
Collapse file

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

Copy file name to clipboardExpand all lines: deps/undici/src/lib/fetch/headers.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict'
44

5-
const { kHeadersList } = require('../core/symbols')
5+
const { kHeadersList, kConstruct } = require('../core/symbols')
66
const { kGuard } = require('./symbols')
77
const { kEnumerableProperty } = require('../core/util')
88
const {
@@ -240,6 +240,9 @@ class HeadersList {
240240
// https://fetch.spec.whatwg.org/#headers-class
241241
class Headers {
242242
constructor (init = undefined) {
243+
if (init === kConstruct) {
244+
return
245+
}
243246
this[kHeadersList] = new HeadersList()
244247

245248
// The new Headers(init) constructor steps are:
Collapse file

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

Copy file name to clipboardExpand all lines: deps/undici/src/lib/fetch/index.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function finalizeAndReportTiming (response, initiatorType = 'other') {
286286
}
287287

288288
// 8. If response’s timing allow passed flag is not set, then:
289-
if (!timingInfo.timingAllowPassed) {
289+
if (!response.timingAllowPassed) {
290290
// 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo.
291291
timingInfo = createOpaqueTimingInfo({
292292
startTime: timingInfo.startTime
Collapse file

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

Copy file name to clipboardExpand all lines: deps/undici/src/lib/fetch/request.js
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ const { kHeaders, kSignal, kState, kGuard, kRealm } = require('./symbols')
2828
const { webidl } = require('./webidl')
2929
const { getGlobalOrigin } = require('./global')
3030
const { URLSerializer } = require('./dataURL')
31-
const { kHeadersList } = require('../core/symbols')
31+
const { kHeadersList, kConstruct } = require('../core/symbols')
3232
const assert = require('assert')
3333
const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = require('events')
3434

3535
let TransformStream = globalThis.TransformStream
3636

37-
const kInit = Symbol('init')
3837
const kAbortController = Symbol('abortController')
3938

4039
const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
@@ -45,7 +44,7 @@ const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
4544
class Request {
4645
// https://fetch.spec.whatwg.org/#dom-request
4746
constructor (input, init = {}) {
48-
if (input === kInit) {
47+
if (input === kConstruct) {
4948
return
5049
}
5150

@@ -302,7 +301,7 @@ class Request {
302301
}
303302

304303
// 23. If init["integrity"] exists, then set request’s integrity metadata to it.
305-
if (init.integrity !== undefined && init.integrity != null) {
304+
if (init.integrity != null) {
306305
request.integrity = String(init.integrity)
307306
}
308307

@@ -398,7 +397,7 @@ class Request {
398397
// 30. Set this’s headers to a new Headers object with this’s relevant
399398
// Realm, whose header list is request’s header list and guard is
400399
// "request".
401-
this[kHeaders] = new Headers()
400+
this[kHeaders] = new Headers(kConstruct)
402401
this[kHeaders][kHeadersList] = request.headersList
403402
this[kHeaders][kGuard] = 'request'
404403
this[kHeaders][kRealm] = this[kRealm]
@@ -725,10 +724,10 @@ class Request {
725724

726725
// 3. Let clonedRequestObject be the result of creating a Request object,
727726
// given clonedRequest, this’s headers’s guard, and this’s relevant Realm.
728-
const clonedRequestObject = new Request(kInit)
727+
const clonedRequestObject = new Request(kConstruct)
729728
clonedRequestObject[kState] = clonedRequest
730729
clonedRequestObject[kRealm] = this[kRealm]
731-
clonedRequestObject[kHeaders] = new Headers()
730+
clonedRequestObject[kHeaders] = new Headers(kConstruct)
732731
clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList
733732
clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard]
734733
clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm]
Collapse file

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

Copy file name to clipboardExpand all lines: deps/undici/src/lib/fetch/response.js
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const { webidl } = require('./webidl')
2323
const { FormData } = require('./formdata')
2424
const { getGlobalOrigin } = require('./global')
2525
const { URLSerializer } = require('./dataURL')
26-
const { kHeadersList } = require('../core/symbols')
26+
const { kHeadersList, kConstruct } = require('../core/symbols')
2727
const assert = require('assert')
2828
const { types } = require('util')
2929

@@ -144,7 +144,7 @@ class Response {
144144
// 2. Set this’s headers to a new Headers object with this’s relevant
145145
// Realm, whose header list is this’s response’s header list and guard
146146
// is "response".
147-
this[kHeaders] = new Headers()
147+
this[kHeaders] = new Headers(kConstruct)
148148
this[kHeaders][kGuard] = 'response'
149149
this[kHeaders][kHeadersList] = this[kState].headersList
150150
this[kHeaders][kRealm] = this[kRealm]
@@ -514,11 +514,7 @@ webidl.converters.XMLHttpRequestBodyInit = function (V) {
514514
return webidl.converters.Blob(V, { strict: false })
515515
}
516516

517-
if (
518-
types.isAnyArrayBuffer(V) ||
519-
types.isTypedArray(V) ||
520-
types.isDataView(V)
521-
) {
517+
if (types.isArrayBuffer(V) || types.isTypedArray(V) || types.isDataView(V)) {
522518
return webidl.converters.BufferSource(V)
523519
}
524520

Collapse file

‎deps/undici/src/lib/handler/RetryHandler.js‎

Copy file name to clipboardExpand all lines: deps/undici/src/lib/handler/RetryHandler.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const assert = require('node:assert')
1+
const assert = require('assert')
22

33
const { kRetryHandlerDefaultRetry } = require('../core/symbols')
44
const { RequestRetryError } = require('../core/errors')
@@ -95,7 +95,7 @@ class RetryHandler {
9595
}
9696

9797
onBodySent (chunk) {
98-
return this.handler.onBodySent(chunk)
98+
if (this.handler.onBodySent) return this.handler.onBodySent(chunk)
9999
}
100100

101101
static [kRetryHandlerDefaultRetry] (err, { state, opts }, cb) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.