deps: update undici to 5.16.0

PR-URL: https://github.com/nodejs/node/pull/46213
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and Juan José Arboleda committed 2023-02-14 21:35:12 -05:00
1 parent 90994e6a2c
commit b4e49fb02c
11 files changed
+492 -3463

No files matched your search

+9 -1
View File
@@ -24,6 +24,14 @@ const nodeVersion = process.versions.node.split('.')
const nodeMajor = Number(nodeVersion[0])
const nodeMinor = Number(nodeVersion[1])
let hasCrypto
try {
require('crypto')
hasCrypto = true
} catch {
hasCrypto = false
}
Object.assign(Dispatcher.prototype, api)
module.exports.Dispatcher = Dispatcher
@@ -128,7 +136,7 @@ if (nodeMajor >= 16) {
module.exports.setCookie = setCookie
}
if (nodeMajor >= 18) {
if (nodeMajor >= 18 && hasCrypto) {
const { WebSocket } = require('./lib/websocket/websocket')
module.exports.WebSocket = WebSocket
+5 -6
View File
@@ -404,8 +404,7 @@ async function lazyllhttp () {
let llhttpInstance = null
let llhttpPromise = lazyllhttp()
.catch(() => {
})
llhttpPromise.catch()
let currentParser = null
let currentBufferRef = null
@@ -1074,8 +1073,6 @@ async function connect (client) {
assert(socket)
client[kSocket] = socket
socket[kNoRef] = false
socket[kWriting] = false
socket[kReset] = false
@@ -1091,6 +1088,8 @@ async function connect (client) {
.on('end', onSocketEnd)
.on('close', onSocketClose)
client[kSocket] = socket
if (channels.connected.hasSubscribers) {
channels.connected.publish({
connectParams: {
@@ -1176,7 +1175,7 @@ function _resume (client, sync) {
const socket = client[kSocket]
if (socket) {
if (socket && !socket.destroyed) {
if (client[kSize] === 0) {
if (!socket[kNoRef] && socket.unref) {
socket.unref()
@@ -1243,7 +1242,7 @@ function _resume (client, sync) {
if (!socket) {
connect(client)
continue
return
}
if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) {
+16 -1
View File
@@ -354,8 +354,23 @@ function ReadableStreamFrom (iterable) {
)
}
// The chunk should be a FormData instance and contains
// all the required methods.
function isFormDataLike (chunk) {
return chunk && chunk.constructor && chunk.constructor.name === 'FormData'
return (chunk &&
chunk.constructor && chunk.constructor.name === 'FormData' &&
typeof chunk === 'object' &&
(typeof chunk.append === 'function' &&
typeof chunk.delete === 'function' &&
typeof chunk.get === 'function' &&
typeof chunk.getAll === 'function' &&
typeof chunk.has === 'function' &&
typeof chunk.set === 'function' &&
typeof chunk.entries === 'function' &&
typeof chunk.keys === 'function' &&
typeof chunk.values === 'function' &&
typeof chunk.forEach === 'function')
)
}
const kEnumerableProperty = Object.create(null)
+12 -9
View File
@@ -5,6 +5,12 @@ const { isValidHTTPToken, isomorphicDecode } = require('./util')
const encoder = new TextEncoder()
// Regex
const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+-.^_|~A-z0-9]+$/
const HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/ // eslint-disable-line
// https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
const HTTP_QUOTED_STRING_TOKENS = /^(\u0009|\x{0020}-\x{007E}|\x{0080}-\x{00FF})+$/ // eslint-disable-line
// https://fetch.spec.whatwg.org/#data-url-processor
/** @param {URL} dataURL */
function dataURLProcessor (dataURL) {
@@ -217,7 +223,7 @@ function parseMIMEType (input) {
// 4. If type is the empty string or does not solely
// contain HTTP token code points, then return failure.
// https://mimesniff.spec.whatwg.org/#http-token-code-point
if (type.length === 0 || !/^[!#$%&'*+-.^_|~A-z0-9]+$/.test(type)) {
if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) {
return 'failure'
}
@@ -244,7 +250,7 @@ function parseMIMEType (input) {
// 9. If subtype is the empty string or does not solely
// contain HTTP token code points, then return failure.
if (subtype.length === 0 || !/^[!#$%&'*+-.^_|~A-z0-9]+$/.test(subtype)) {
if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) {
return 'failure'
}
@@ -258,9 +264,7 @@ function parseMIMEType (input) {
/** @type {Map<string, string>} */
parameters: new Map(),
// https://mimesniff.spec.whatwg.org/#mime-type-essence
get essence () {
return `${this.type}/${this.subtype}`
}
essence: `${type}/${subtype}`
}
// 11. While position is not past the end of input:
@@ -272,7 +276,7 @@ function parseMIMEType (input) {
// whitespace from input given position.
collectASequenceOfCodePoints(
// https://fetch.spec.whatwg.org/#http-whitespace
(char) => /(\u000A|\u000D|\u0009|\u0020)/.test(char), // eslint-disable-line
char => HTTP_WHITESPACE_REGEX.test(char),
input,
position
)
@@ -355,9 +359,8 @@ function parseMIMEType (input) {
// then set mimeType’s parameters[parameterName] to parameterValue.
if (
parameterName.length !== 0 &&
/^[!#$%&'*+-.^_|~A-z0-9]+$/.test(parameterName) &&
// https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
!/^(\u0009|\x{0020}-\x{007E}|\x{0080}-\x{00FF})+$/.test(parameterValue) && // eslint-disable-line
HTTP_TOKEN_CODEPOINTS.test(parameterName) &&
!HTTP_QUOTED_STRING_TOKENS.test(parameterValue) &&
!mimeType.parameters.has(parameterName)
) {
mimeType.parameters.set(parameterName, parameterValue)
+1 -3
View File
@@ -56,7 +56,7 @@ const { Readable, pipeline } = require('stream')
const { isErrored, isReadable } = require('../core/util')
const { dataURLProcessor, serializeAMimeType } = require('./dataURL')
const { TransformStream } = require('stream/web')
const { getGlobalDispatcher } = require('../../index')
const { getGlobalDispatcher } = require('../global')
const { webidl } = require('./webidl')
const { STATUS_CODES } = require('http')
@@ -1951,8 +1951,6 @@ async function httpNetworkFetch (
body: fetchParams.controller.dispatcher.isMockActive ? request.body && request.body.source : body,
headers: request.headersList[kHeadersCaseInsensitive],
maxRedirections: 0,
bodyTimeout: 300_000,
headersTimeout: 300_000,
upgrade: request.mode === 'websocket' ? 'websocket' : undefined
},
{
+1 -1
View File
@@ -53,7 +53,7 @@ class ProxyAgent extends DispatcherBase {
this[kRequestTls] = opts.requestTls
this[kProxyTls] = opts.proxyTls
this[kProxyHeaders] = {}
this[kProxyHeaders] = opts.headers || {}
if (opts.auth && opts.token) {
throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token')
-1
View File
@@ -1,6 +1,5 @@
'use strict'
// TODO: crypto isn't available in all environments
const { randomBytes, createHash } = require('crypto')
const diagnosticsChannel = require('diagnostics_channel')
const { uid, states } = require('./constants')
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "undici",
"version": "5.15.1",
"version": "5.16.0",
"description": "An HTTP/1.1 client, written from scratch for Node.js",
"homepage": "https://undici.nodejs.org",
"bugs": {
@@ -79,6 +79,7 @@
"cronometro": "^1.0.5",
"delay": "^5.0.0",
"docsify-cli": "^4.4.3",
"form-data": "^4.0.0",
"formdata-node": "^4.3.1",
"https-pem": "^3.0.0",
"husky": "^8.0.1",
+3
View File
@@ -1,3 +1,5 @@
import { IncomingHttpHeaders } from 'http'
import Agent from './agent'
import buildConnector from './connector';
import Dispatcher from './dispatcher'
@@ -19,6 +21,7 @@ declare namespace ProxyAgent {
*/
auth?: string;
token?: string;
headers?: IncomingHttpHeaders;
requestTls?: buildConnector.BuildOptions;
proxyTls?: buildConnector.BuildOptions;
}
+442 -3439
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -2,5 +2,5 @@
// Refer to tools/update-undici.sh
#ifndef SRC_UNDICI_VERSION_H_
#define SRC_UNDICI_VERSION_H_
#define UNDICI_VERSION "5.15.1"
#define UNDICI_VERSION "5.16.0"
#endif // SRC_UNDICI_VERSION_H_