deps: update undici to 5.28.1

PR-URL: https://github.com/nodejs/node/pull/50975
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and GitHub committed 2023-12-02 14:38:58 +00:00
1 parent d5a7acf068
commit 78855fdefe
9 files changed
+216 -146

No files matched your search

+12 -19
View File
@@ -917,11 +917,9 @@ class Parser {
socket[kReset] = true
}
let pause
try {
pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
} catch (err) {
util.destroy(socket, err)
const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
if (request.aborted) {
return -1
}
@@ -968,13 +966,8 @@ class Parser {
this.bytesRead += buf.length
try {
if (request.onData(buf) === false) {
return constants.ERROR.PAUSED
}
} catch (err) {
util.destroy(socket, err)
return -1
if (request.onData(buf) === false) {
return constants.ERROR.PAUSED
}
}
@@ -1015,11 +1008,7 @@ class Parser {
return -1
}
try {
request.onComplete(headers)
} catch (err) {
errorRequest(client, request, err)
}
request.onComplete(headers)
client[kQueue][client[kRunningIdx]++] = null
@@ -1805,13 +1794,17 @@ function writeH2 (client, session, request) {
})
stream.on('data', (chunk) => {
if (request.onData(chunk) === false) stream.pause()
if (request.onData(chunk) === false) {
stream.pause()
}
})
stream.once('close', () => {
h2State.openStreams -= 1
// TODO(HTTP/2): unref only if current streams count is 0
if (h2State.openStreams === 0) session.unref()
if (h2State.openStreams === 0) {
session.unref()
}
})
stream.once('error', function (err) {
+29 -5
View File
@@ -229,7 +229,11 @@ class Request {
onBodySent (chunk) {
if (this[kHandler].onBodySent) {
return this[kHandler].onBodySent(chunk)
try {
return this[kHandler].onBodySent(chunk)
} catch (err) {
this.abort(err)
}
}
}
@@ -239,7 +243,11 @@ class Request {
}
if (this[kHandler].onRequestSent) {
return this[kHandler].onRequestSent()
try {
return this[kHandler].onRequestSent()
} catch (err) {
this.abort(err)
}
}
}
@@ -263,14 +271,23 @@ class Request {
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
}
return this[kHandler].onHeaders(statusCode, headers, resume, statusText)
try {
return this[kHandler].onHeaders(statusCode, headers, resume, statusText)
} catch (err) {
this.abort(err)
}
}
onData (chunk) {
assert(!this.aborted)
assert(!this.completed)
return this[kHandler].onData(chunk)
try {
return this[kHandler].onData(chunk)
} catch (err) {
this.abort(err)
return false
}
}
onUpgrade (statusCode, headers, socket) {
@@ -289,7 +306,13 @@ class Request {
if (channels.trailers.hasSubscribers) {
channels.trailers.publish({ request: this, trailers })
}
return this[kHandler].onComplete(trailers)
try {
return this[kHandler].onComplete(trailers)
} catch (err) {
// TODO (fix): This might be a bad idea?
this.onError(err)
}
}
onError (error) {
@@ -303,6 +326,7 @@ class Request {
return
}
this.aborted = true
return this[kHandler].onError(error)
}
+18 -15
View File
@@ -10,7 +10,8 @@ const {
isValidHTTPToken,
sameOrigin,
normalizeMethod,
makePolicyContainer
makePolicyContainer,
normalizeMethodRecord
} = require('./util')
const {
forbiddenMethodsSet,
@@ -183,8 +184,10 @@ class Request {
urlList: [...request.urlList]
})
const initHasKey = Object.keys(init).length !== 0
// 13. If init is not empty, then:
if (Object.keys(init).length > 0) {
if (initHasKey) {
// 1. If request’s mode is "navigate", then set it to "same-origin".
if (request.mode === 'navigate') {
request.mode = 'same-origin'
@@ -315,16 +318,16 @@ class Request {
// 2. If method is not a method or method is a forbidden method, then
// throw a TypeError.
if (!isValidHTTPToken(init.method)) {
throw new TypeError(`'${init.method}' is not a valid HTTP method.`)
if (!isValidHTTPToken(method)) {
throw new TypeError(`'${method}' is not a valid HTTP method.`)
}
if (forbiddenMethodsSet.has(method.toUpperCase())) {
throw new TypeError(`'${init.method}' HTTP method is unsupported.`)
throw new TypeError(`'${method}' HTTP method is unsupported.`)
}
// 3. Normalize method.
method = normalizeMethod(init.method)
method = normalizeMethodRecord[method] ?? normalizeMethod(method)
// 4. Set request’s method to method.
request.method = method
@@ -415,25 +418,25 @@ class Request {
}
// 32. If init is not empty, then:
if (Object.keys(init).length !== 0) {
if (initHasKey) {
/** @type {HeadersList} */
const headersList = this[kHeaders][kHeadersList]
// 1. Let headers be a copy of this’s headers and its associated header
// list.
let headers = new Headers(this[kHeaders])
// 2. If init["headers"] exists, then set headers to init["headers"].
if (init.headers !== undefined) {
headers = init.headers
}
const headers = init.headers !== undefined ? init.headers : new HeadersList(headersList)
// 3. Empty this’s headers’s header list.
this[kHeaders][kHeadersList].clear()
headersList.clear()
// 4. If headers is a Headers object, then for each header in its header
// list, append header’s name/header’s value to this’s headers.
if (headers.constructor.name === 'Headers') {
if (headers instanceof HeadersList) {
for (const [key, val] of headers) {
this[kHeaders].append(key, val)
headersList.append(key, val)
}
// Note: Copy the `set-cookie` meta-data.
headersList.cookies = headers.cookies
} else {
// 5. Otherwise, fill this’s headers with headers.
fillHeaders(this[kHeaders], headers)
+25 -5
View File
@@ -698,11 +698,30 @@ function isCancelled (fetchParams) {
fetchParams.controller.state === 'terminated'
}
// https://fetch.spec.whatwg.org/#concept-method-normalize
const normalizeMethodRecord = {
delete: 'DELETE',
DELETE: 'DELETE',
get: 'GET',
GET: 'GET',
head: 'HEAD',
HEAD: 'HEAD',
options: 'OPTIONS',
OPTIONS: 'OPTIONS',
post: 'POST',
POST: 'POST',
put: 'PUT',
PUT: 'PUT'
}
// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
Object.setPrototypeOf(normalizeMethodRecord, null)
/**
* @see https://fetch.spec.whatwg.org/#concept-method-normalize
* @param {string} method
*/
function normalizeMethod (method) {
return /^(DELETE|GET|HEAD|OPTIONS|POST|PUT)$/i.test(method)
? method.toUpperCase()
: method
return normalizeMethodRecord[method.toLowerCase()] ?? method
}
// https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string
@@ -1047,5 +1066,6 @@ module.exports = {
urlIsLocal,
urlHasHttpsScheme,
urlIsHttpHttpsScheme,
readAllBytes
readAllBytes,
normalizeMethodRecord
}
+59 -57
View File
@@ -1,12 +1,12 @@
{
"name": "undici",
"version": "5.28.0",
"version": "5.28.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "undici",
"version": "5.28.0",
"version": "5.28.1",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
@@ -83,9 +83,9 @@
"dev": true
},
"node_modules/@babel/code-frame": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.4.tgz",
"integrity": "sha512-r1IONyb6Ia+jYR2vvIDhdWdlTGhqbBoFqLTQidzZ4kepUFH15ejXvFHxCVbtl7BOXIudsIubf4E81xeA3h3IXA==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
"integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
"dev": true,
"dependencies": {
"@babel/highlight": "^7.23.4",
@@ -167,30 +167,30 @@
}
},
"node_modules/@babel/compat-data": {
"version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.3.tgz",
"integrity": "sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz",
"integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/core": {
"version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.3.tgz",
"integrity": "sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz",
"integrity": "sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==",
"dev": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.23.3",
"@babel/code-frame": "^7.23.5",
"@babel/generator": "^7.23.5",
"@babel/helper-compilation-targets": "^7.22.15",
"@babel/helper-module-transforms": "^7.23.3",
"@babel/helpers": "^7.23.2",
"@babel/parser": "^7.23.3",
"@babel/helpers": "^7.23.5",
"@babel/parser": "^7.23.5",
"@babel/template": "^7.22.15",
"@babel/traverse": "^7.23.3",
"@babel/types": "^7.23.3",
"@babel/traverse": "^7.23.5",
"@babel/types": "^7.23.5",
"convert-source-map": "^2.0.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.2",
@@ -238,12 +238,12 @@
}
},
"node_modules/@babel/generator": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.4.tgz",
"integrity": "sha512-esuS49Cga3HcThFNebGhlgsrVLkvhqvYDTzgjfFFlHJcIfLe5jFmRRfCQ1KuBfc4Jrtn3ndLgKWAKjBE+IraYQ==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.5.tgz",
"integrity": "sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA==",
"dev": true,
"dependencies": {
"@babel/types": "^7.23.4",
"@babel/types": "^7.23.5",
"@jridgewell/gen-mapping": "^0.3.2",
"@jridgewell/trace-mapping": "^0.3.17",
"jsesc": "^2.5.1"
@@ -394,23 +394,23 @@
}
},
"node_modules/@babel/helper-validator-option": {
"version": "7.22.15",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz",
"integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz",
"integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helpers": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.4.tgz",
"integrity": "sha512-HfcMizYz10cr3h29VqyfGL6ZWIjTwWfvYBMsBVGwpcbhNGe3wQ1ZXZRPzZoAHhd9OqHadHqjQ89iVKINXnbzuw==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.5.tgz",
"integrity": "sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg==",
"dev": true,
"dependencies": {
"@babel/template": "^7.22.15",
"@babel/traverse": "^7.23.4",
"@babel/types": "^7.23.4"
"@babel/traverse": "^7.23.5",
"@babel/types": "^7.23.5"
},
"engines": {
"node": ">=6.9.0"
@@ -502,9 +502,9 @@
}
},
"node_modules/@babel/parser": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.4.tgz",
"integrity": "sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.5.tgz",
"integrity": "sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==",
"dev": true,
"bin": {
"parser": "bin/babel-parser.js"
@@ -691,9 +691,9 @@
}
},
"node_modules/@babel/runtime": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.4.tgz",
"integrity": "sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.5.tgz",
"integrity": "sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w==",
"dev": true,
"dependencies": {
"regenerator-runtime": "^0.14.0"
@@ -717,19 +717,19 @@
}
},
"node_modules/@babel/traverse": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.4.tgz",
"integrity": "sha512-IYM8wSUwunWTB6tFC2dkKZhxbIjHoWemdK+3f8/wq8aKhbUscxD5MX72ubd90fxvFknaLPeGw5ycU84V1obHJg==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.5.tgz",
"integrity": "sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w==",
"dev": true,
"dependencies": {
"@babel/code-frame": "^7.23.4",
"@babel/generator": "^7.23.4",
"@babel/code-frame": "^7.23.5",
"@babel/generator": "^7.23.5",
"@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-function-name": "^7.23.0",
"@babel/helper-hoist-variables": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6",
"@babel/parser": "^7.23.4",
"@babel/types": "^7.23.4",
"@babel/parser": "^7.23.5",
"@babel/types": "^7.23.5",
"debug": "^4.1.0",
"globals": "^11.1.0"
},
@@ -761,9 +761,9 @@
"dev": true
},
"node_modules/@babel/types": {
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.4.tgz",
"integrity": "sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.5.tgz",
"integrity": "sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w==",
"dev": true,
"dependencies": {
"@babel/helper-string-parser": "^7.23.4",
@@ -1003,9 +1003,9 @@
}
},
"node_modules/@httptoolkit/httpolyglot/node_modules/@types/node": {
"version": "16.18.65",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.65.tgz",
"integrity": "sha512-5E9WgTy95B7i90oISjui9U5Zu7iExUPfU4ygtv4yXEy6zJFE3oQYHCnh5H1jZRPkjphJt2Ml3oQW6M0qtK534A==",
"version": "16.18.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.66.tgz",
"integrity": "sha512-sePmD/imfKvC4re/Wwos1NEcXYm6O96CAG5gQVY53nmDb8ePQ4qPku6uruN7n6TJ0t5FhcoUc2+yvE2/UZVDZw==",
"dev": true
},
"node_modules/@httptoolkit/subscriptions-transport-ws": {
@@ -1764,9 +1764,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "18.18.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.13.tgz",
"integrity": "sha512-vXYZGRrSCreZmq1rEjMRLXJhiy8MrIeVasx+PCVlP414N7CJLHnMf+juVvjdprHyH+XRy3zKZLHeNueOpJCn0g==",
"version": "18.18.14",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz",
"integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -1827,6 +1827,7 @@
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
"integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
"deprecated": "Use your platform's native atob() and btoa() methods instead",
"dev": true
},
"node_modules/abort-controller": {
@@ -2952,9 +2953,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001564",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001564.tgz",
"integrity": "sha512-DqAOf+rhof+6GVx1y+xzbFPeOumfQnhYzVnZD6LAXijR77yPtm9mfOcqOnT3mpnJiZVT+kwLAFnRlZcIz+c6bg==",
"version": "1.0.30001565",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001565.tgz",
"integrity": "sha512-xrE//a3O7TP0vaJ8ikzkD2c2NgcVUvsEe2IvFTntV4Yd1Z9FVzh+gW+enX96L0psrbaFMcVcH2l90xNuGDWc8w==",
"dev": true,
"funding": [
{
@@ -4148,6 +4149,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
"integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==",
"deprecated": "Use your platform's native DOMException instead",
"dev": true,
"dependencies": {
"webidl-conversions": "^7.0.0"
@@ -4193,9 +4195,9 @@
"dev": true
},
"node_modules/electron-to-chromium": {
"version": "1.4.594",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.594.tgz",
"integrity": "sha512-xT1HVAu5xFn7bDfkjGQi9dNpMqGchUkebwf1GL7cZN32NSwwlHRPMSDJ1KN6HkS0bWUtndbSQZqvpQftKG2uFQ==",
"version": "1.4.597",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.597.tgz",
"integrity": "sha512-0XOQNqHhg2YgRVRUrS4M4vWjFCFIP2ETXcXe/0KIQBjXE9Cpy+tgzzYfuq6HGai3hWq0YywtG+5XK8fyG08EjA==",
"dev": true
},
"node_modules/emittery": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "undici",
"version": "5.28.0",
"version": "5.28.1",
"description": "An HTTP/1.1 client, written from scratch for Node.js",
"homepage": "https://undici.nodejs.org",
"bugs": {
+68 -40
View File
@@ -1406,8 +1406,23 @@ var require_util2 = __commonJS({
return fetchParams.controller.state === "aborted" || fetchParams.controller.state === "terminated";
}
__name(isCancelled, "isCancelled");
var normalizeMethodRecord = {
delete: "DELETE",
DELETE: "DELETE",
get: "GET",
GET: "GET",
head: "HEAD",
HEAD: "HEAD",
options: "OPTIONS",
OPTIONS: "OPTIONS",
post: "POST",
POST: "POST",
put: "PUT",
PUT: "PUT"
};
Object.setPrototypeOf(normalizeMethodRecord, null);
function normalizeMethod(method) {
return /^(DELETE|GET|HEAD|OPTIONS|POST|PUT)$/i.test(method) ? method.toUpperCase() : method;
return normalizeMethodRecord[method.toLowerCase()] ?? method;
}
__name(normalizeMethod, "normalizeMethod");
function serializeJavascriptValueToJSONString(value) {
@@ -1600,7 +1615,8 @@ var require_util2 = __commonJS({
urlIsLocal,
urlHasHttpsScheme,
urlIsHttpHttpsScheme,
readAllBytes
readAllBytes,
normalizeMethodRecord
};
}
});
@@ -5869,7 +5885,8 @@ var require_request = __commonJS({
isValidHTTPToken,
sameOrigin,
normalizeMethod,
makePolicyContainer
makePolicyContainer,
normalizeMethodRecord
} = require_util2();
var {
forbiddenMethodsSet,
@@ -5993,7 +6010,8 @@ var require_request = __commonJS({
// URL list A clone of request’s URL list.
urlList: [...request.urlList]
});
if (Object.keys(init).length > 0) {
const initHasKey = Object.keys(init).length !== 0;
if (initHasKey) {
if (request.mode === "navigate") {
request.mode = "same-origin";
}
@@ -6063,13 +6081,13 @@ var require_request = __commonJS({
}
if (init.method !== void 0) {
let method = init.method;
if (!isValidHTTPToken(init.method)) {
throw new TypeError(`'${init.method}' is not a valid HTTP method.`);
if (!isValidHTTPToken(method)) {
throw new TypeError(`'${method}' is not a valid HTTP method.`);
}
if (forbiddenMethodsSet.has(method.toUpperCase())) {
throw new TypeError(`'${init.method}' HTTP method is unsupported.`);
throw new TypeError(`'${method}' HTTP method is unsupported.`);
}
method = normalizeMethod(init.method);
method = normalizeMethodRecord[method] ?? normalizeMethod(method);
request.method = method;
}
if (init.signal !== void 0) {
@@ -6120,16 +6138,15 @@ var require_request = __commonJS({
}
this[kHeaders][kGuard] = "request-no-cors";
}
if (Object.keys(init).length !== 0) {
let headers = new Headers(this[kHeaders]);
if (init.headers !== void 0) {
headers = init.headers;
}
this[kHeaders][kHeadersList].clear();
if (headers.constructor.name === "Headers") {
if (initHasKey) {
const headersList = this[kHeaders][kHeadersList];
const headers = init.headers !== void 0 ? init.headers : new HeadersList(headersList);
headersList.clear();
if (headers instanceof HeadersList) {
for (const [key, val] of headers) {
this[kHeaders].append(key, val);
headersList.append(key, val);
}
headersList.cookies = headers.cookies;
} else {
fillHeaders(this[kHeaders], headers);
}
@@ -7205,7 +7222,11 @@ var require_request2 = __commonJS({
}
onBodySent(chunk) {
if (this[kHandler].onBodySent) {
return this[kHandler].onBodySent(chunk);
try {
return this[kHandler].onBodySent(chunk);
} catch (err) {
this.abort(err);
}
}
}
onRequestSent() {
@@ -7213,7 +7234,11 @@ var require_request2 = __commonJS({
channels.bodySent.publish({ request: this });
}
if (this[kHandler].onRequestSent) {
return this[kHandler].onRequestSent();
try {
return this[kHandler].onRequestSent();
} catch (err) {
this.abort(err);
}
}
}
onConnect(abort) {
@@ -7232,12 +7257,21 @@ var require_request2 = __commonJS({
if (channels.headers.hasSubscribers) {
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
}
return this[kHandler].onHeaders(statusCode, headers, resume, statusText);
try {
return this[kHandler].onHeaders(statusCode, headers, resume, statusText);
} catch (err) {
this.abort(err);
}
}
onData(chunk) {
assert(!this.aborted);
assert(!this.completed);
return this[kHandler].onData(chunk);
try {
return this[kHandler].onData(chunk);
} catch (err) {
this.abort(err);
return false;
}
}
onUpgrade(statusCode, headers, socket) {
assert(!this.aborted);
@@ -7251,7 +7285,11 @@ var require_request2 = __commonJS({
if (channels.trailers.hasSubscribers) {
channels.trailers.publish({ request: this, trailers });
}
return this[kHandler].onComplete(trailers);
try {
return this[kHandler].onComplete(trailers);
} catch (err) {
this.onError(err);
}
}
onError(error) {
this.onFinally();
@@ -8811,11 +8849,8 @@ var require_client = __commonJS({
} else {
socket[kReset] = true;
}
let pause;
try {
pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false;
} catch (err) {
util.destroy(socket, err);
const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false;
if (request.aborted) {
return -1;
}
if (request.method === "HEAD") {
@@ -8849,13 +8884,8 @@ var require_client = __commonJS({
return -1;
}
this.bytesRead += buf.length;
try {
if (request.onData(buf) === false) {
return constants.ERROR.PAUSED;
}
} catch (err) {
util.destroy(socket, err);
return -1;
if (request.onData(buf) === false) {
return constants.ERROR.PAUSED;
}
}
onMessageComplete() {
@@ -8885,11 +8915,7 @@ var require_client = __commonJS({
util.destroy(socket, new ResponseContentLengthMismatchError());
return -1;
}
try {
request.onComplete(headers);
} catch (err) {
errorRequest(client, request, err);
}
request.onComplete(headers);
client[kQueue][client[kRunningIdx]++] = null;
if (socket[kWriting]) {
assert.strictEqual(client[kRunning], 0);
@@ -9459,13 +9485,15 @@ upgrade: ${upgrade}\r
request.onComplete([]);
});
stream.on("data", (chunk) => {
if (request.onData(chunk) === false)
if (request.onData(chunk) === false) {
stream.pause();
}
});
stream.once("close", () => {
h2State.openStreams -= 1;
if (h2State.openStreams === 0)
if (h2State.openStreams === 0) {
session.unref();
}
});
stream.once("error", function(err) {
if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) {
@@ -29,7 +29,7 @@ This a list of all the dependencies:
* [postject 1.0.0-alpha.6][]
* [simdjson 3.6.0][]
* [simdutf 4.0.4][]
* [undici 5.28.0][]
* [undici 5.28.1][]
* [uvwasi 0.0.19][]
* [V8 11.8.172.12][]
* [zlib 1.2.13.1-motley-5daffc7][]
@@ -297,7 +297,7 @@ a C++ library for fast JSON parsing.
The [simdutf](https://github.com/simdutf/simdutf) dependency is
a C++ library for fast UTF-8 decoding and encoding.
### undici 5.28.0
### undici 5.28.1
The [undici](https://github.com/nodejs/undici) dependency is an HTTP/1.1 client,
written from scratch for Node.js..
@@ -352,7 +352,7 @@ performance improvements not currently available in standard zlib.
[postject 1.0.0-alpha.6]: #postject-100-alpha6
[simdjson 3.6.0]: #simdutf-360
[simdutf 4.0.4]: #simdutf-404
[undici 5.28.0]: #undici-5280
[undici 5.28.1]: #undici-5281
[update-openssl-action]: ../../../.github/workflows/update-openssl.yml
[uvwasi 0.0.19]: #uvwasi-0019
[v8 11.8.172.12]: #v8-11817212
+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 "5.28.0"
#define UNDICI_VERSION "5.28.1"
#endif // SRC_UNDICI_VERSION_H_