Skip to content

Commit a670c1f

Browse files
nodejs-github-botdanielleadams
authored andcommitted
deps: update undici to 4.16.0
PR-URL: #42414 Backport-PR-URL: #42727 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 721d107 commit a670c1f

23 files changed

+124
-77
lines changed

deps/undici/src/docs/api/Dispatcher.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ The `RequestOptions.method` property should not be value `'CONNECT'`.
489489
- `body`
490490
- `bodyUsed`
491491

492+
`body` can not be consumed twice. For example, calling `text()` after `json()` throws `TypeError`.
493+
492494
`body` contains the following additional extensions:
493495

494496
- `dump({ limit: Integer })`, dump the response by reading up to `limit` bytes without killing the socket (optional) - Default: 262144.

deps/undici/src/lib/balanced-pool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const kFactory = Symbol('factory')
2020
const kOptions = Symbol('options')
2121

2222
function defaultFactory (origin, opts) {
23-
return new Pool(origin, opts);
23+
return new Pool(origin, opts)
2424
}
2525

2626
class BalancedPool extends PoolBase {

deps/undici/src/lib/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ class Parser {
794794
return -1
795795
}
796796

797-
/* istanbul ignore if: this can only happen if server is misbehaving */
797+
/* this can only happen if server is misbehaving */
798798
if (upgrade && !request.upgrade) {
799799
util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket)))
800800
return -1

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function buildConnector ({ maxCachedSessions, socketPath, timeout, ...opts }) {
2525
let socket
2626
if (protocol === 'https:') {
2727
if (!tls) {
28-
tls = require('tls')
28+
tls = require('tls')
2929
}
3030
servername = servername || options.servername || util.getServerName(host) || null
3131

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function parseHeaders (headers, obj = {}) {
201201
}
202202

203203
function parseRawHeaders (headers) {
204-
return headers.map(header => header.toString());
204+
return headers.map(header => header.toString())
205205
}
206206

207207
function isBuffer (buffer) {
@@ -263,15 +263,15 @@ function isErrored (body) {
263263
stream.isErrored
264264
? stream.isErrored(body)
265265
: /state: 'errored'/.test(nodeUtil.inspect(body)
266-
)))
266+
)))
267267
}
268268

269269
function isReadable (body) {
270270
return !!(body && (
271271
stream.isReadable
272272
? stream.isReadable(body)
273273
: /state: 'readable'/.test(nodeUtil.inspect(body)
274-
)))
274+
)))
275275
}
276276

277277
function getSocketInfo (socket) {

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,20 @@ function percentDecode (input) {
227227
// 1. If byte is not 0x25 (%), then append byte to output.
228228
if (byte !== 0x25) {
229229
output.push(byte)
230-
}
231230

232231
// 2. Otherwise, if byte is 0x25 (%) and the next two bytes
233232
// after byte in input are not in the ranges
234233
// 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F),
235234
// and 0x61 (a) to 0x66 (f), all inclusive, append byte
236235
// to output.
237-
else if (
236+
} else if (
238237
byte === 0x25 &&
239238
!/^[0-9A-Fa-f]{2}$/i.test(String.fromCharCode(input[i + 1], input[i + 2]))
240239
) {
241240
output.push(0x25)
242-
}
243241

244242
// 3. Otherwise:
245-
else {
243+
} else {
246244
// 1. Let bytePoint be the two bytes after byte in input,
247245
// decoded, and then interpreted as hexadecimal number.
248246
const nextTwoBytes = String.fromCharCode(input[i + 1], input[i + 2])
@@ -334,7 +332,7 @@ function parseMIMEType (input) {
334332
// whitespace from input given position.
335333
collectASequenceOfCodePoints(
336334
// https://fetch.spec.whatwg.org/#http-whitespace
337-
(char) => /(\u000A|\u000D|\u0009|\u0020)/.test(char),
335+
(char) => /(\u000A|\u000D|\u0009|\u0020)/.test(char), // eslint-disable-line
338336
input,
339337
position
340338
)
@@ -389,10 +387,9 @@ function parseMIMEType (input) {
389387
input,
390388
position
391389
)
392-
}
393390

394391
// 9. Otherwise:
395-
else {
392+
} else {
396393
// 1. Set parameterValue to the result of collecting
397394
// a sequence of code points that are not U+003B (;)
398395
// from input, given position.
@@ -421,7 +418,7 @@ function parseMIMEType (input) {
421418
parameterName.length !== 0 &&
422419
/^[!#$%&'*+-.^_|~A-z0-9]+$/.test(parameterName) &&
423420
// https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
424-
!/^(\u0009|\x{0020}-\x{007E}|\x{0080}-\x{00FF})+$/.test(parameterValue) &&
421+
!/^(\u0009|\x{0020}-\x{007E}|\x{0080}-\x{00FF})+$/.test(parameterValue) && // eslint-disable-line
425422
!mimeType.parameters.has(parameterName)
426423
) {
427424
mimeType.parameters.set(parameterName, parameterValue)
@@ -436,7 +433,7 @@ function parseMIMEType (input) {
436433
/** @param {string} data */
437434
function forgivingBase64 (data) {
438435
// 1. Remove all ASCII whitespace from data.
439-
data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '')
436+
data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') // eslint-disable-line
440437

441438
// 2. If data’s code point length divides by 4 leaving
442439
// no remainder, then:
@@ -529,10 +526,9 @@ function collectAnHTTPQuotedString (input, position, extractValue) {
529526

530527
// 3. Advance position by 1.
531528
position.position++
532-
}
533529

534530
// 6. Otherwise:
535-
else {
531+
} else {
536532
// 1. Assert: quoteOrBackslash is U+0022 (").
537533
assert(quoteOrBackslash === '"')
538534

deps/undici/src/lib/fetch/file.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class File extends Blob {
1313

1414
// 1. Let bytes be the result of processing blob parts given fileBits and
1515
// options.
16+
// TODO
1617

1718
// 2. Let n be the fileName argument to the constructor.
1819
const n = fileName
@@ -42,6 +43,7 @@ class File extends Blob {
4243
// F.name is set to n.
4344
// F.type is set to t.
4445
// F.lastModified is set to d.
46+
// TODO
4547

4648
super(fileBits, { type: t })
4749
this[kState] = {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ function fetching ({
329329
processResponse,
330330
processResponseEndOfBody,
331331
processResponseConsumeBody,
332-
useParallelQueue = false,
332+
useParallelQueue = false
333333
}) {
334334
// 1. Let taskDestination be null.
335335
let taskDestination = null
@@ -762,16 +762,16 @@ async function schemeFetch (fetchParams) {
762762
switch (scheme) {
763763
case 'about:': {
764764
// If request’s current URL’s path is the string "blank", then return a new response
765-
// whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
766-
// and body is the empty byte sequence.
765+
// whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
766+
// and body is the empty byte sequence.
767767
if (path === 'blank') {
768768
const resp = makeResponse({
769769
statusText: 'OK',
770770
headersList: [
771771
'content-type', 'text/html;charset=utf-8'
772772
]
773773
})
774-
774+
775775
resp.urlList = [new URL('about:blank')]
776776
return resp
777777
}
@@ -784,12 +784,12 @@ async function schemeFetch (fetchParams) {
784784

785785
context.on('terminated', onRequestAborted)
786786

787-
// 1. Run these steps, but abort when the ongoing fetch is terminated:
787+
// 1. Run these steps, but abort when the ongoing fetch is terminated:
788788
// 1a. Let blob be request’s current URL’s blob URL entry’s object.
789789
// https://w3c.github.io/FileAPI/#blob-url-entry
790790
// P.S. Thank God this method is available in node.
791791
const currentURL = requestCurrentURL(request)
792-
792+
793793
// https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56
794794
// Buffer.resolveObjectURL does not ignore URL queries.
795795
if (currentURL.search.length !== 0) {
@@ -803,7 +803,7 @@ async function schemeFetch (fetchParams) {
803803
return makeNetworkError('invalid method')
804804
}
805805

806-
// 3a. Let response be a new response whose status message is `OK`.
806+
// 3a. Let response be a new response whose status message is `OK`.
807807
const response = makeResponse({ statusText: 'OK', urlList: [currentURL] })
808808

809809
// 4a. Append (`Content-Length`, blob’s size attribute value) to response’s header list.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const util = require('../core/util')
88
const {
99
isValidHTTPToken,
1010
EnvironmentSettingsObject,
11+
sameOrigin,
1112
toUSVString
1213
} = require('./util')
1314
const {

deps/undici/src/lib/fetch/util.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,9 @@ function appendRequestOriginHeader (request) {
214214
if (serializedOrigin) {
215215
request.headersList.append('Origin', serializedOrigin)
216216
}
217-
}
218217

219218
// 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then:
220-
else if (request.method !== 'GET' && request.method !== 'HEAD') {
219+
} else if (request.method !== 'GET' && request.method !== 'HEAD') {
221220
// 1. Switch on request’s referrer policy:
222221
switch (request.referrerPolicy) {
223222
case 'no-referrer':
@@ -307,7 +306,7 @@ function sameOrigin (A, B) {
307306
// 1. If A and B are the same opaque origin, then return true.
308307
// "opaque origin" is an internal value we cannot access, ignore.
309308

310-
// 2. If A and B are both tuple origins and their schemes,
309+
// 2. If A and B are both tuple origins and their schemes,
311310
// hosts, and port are identical, then return true.
312311
if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) {
313312
return true

0 commit comments

Comments
 (0)