Reverted the update
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 31s
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 31s
This commit is contained in:
48
node_modules/undici/lib/client.js
generated
vendored
48
node_modules/undici/lib/client.js
generated
vendored
@ -917,9 +917,11 @@ class Parser {
|
||||
socket[kReset] = true
|
||||
}
|
||||
|
||||
const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
|
||||
|
||||
if (request.aborted) {
|
||||
let pause
|
||||
try {
|
||||
pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
|
||||
} catch (err) {
|
||||
util.destroy(socket, err)
|
||||
return -1
|
||||
}
|
||||
|
||||
@ -966,8 +968,13 @@ class Parser {
|
||||
|
||||
this.bytesRead += buf.length
|
||||
|
||||
if (request.onData(buf) === false) {
|
||||
return constants.ERROR.PAUSED
|
||||
try {
|
||||
if (request.onData(buf) === false) {
|
||||
return constants.ERROR.PAUSED
|
||||
}
|
||||
} catch (err) {
|
||||
util.destroy(socket, err)
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
@ -1008,7 +1015,11 @@ class Parser {
|
||||
return -1
|
||||
}
|
||||
|
||||
request.onComplete(headers)
|
||||
try {
|
||||
request.onComplete(headers)
|
||||
} catch (err) {
|
||||
errorRequest(client, request, err)
|
||||
}
|
||||
|
||||
client[kQueue][client[kRunningIdx]++] = null
|
||||
|
||||
@ -1172,7 +1183,7 @@ async function connect (client) {
|
||||
const idx = hostname.indexOf(']')
|
||||
|
||||
assert(idx !== -1)
|
||||
const ip = hostname.substring(1, idx)
|
||||
const ip = hostname.substr(1, idx - 1)
|
||||
|
||||
assert(net.isIP(ip))
|
||||
hostname = ip
|
||||
@ -1671,7 +1682,6 @@ function writeH2 (client, session, request) {
|
||||
return false
|
||||
}
|
||||
|
||||
/** @type {import('node:http2').ClientHttp2Stream} */
|
||||
let stream
|
||||
const h2State = client[kHTTP2SessionState]
|
||||
|
||||
@ -1767,10 +1777,14 @@ function writeH2 (client, session, request) {
|
||||
const shouldEndStream = method === 'GET' || method === 'HEAD'
|
||||
if (expectContinue) {
|
||||
headers[HTTP2_HEADER_EXPECT] = '100-continue'
|
||||
/**
|
||||
* @type {import('node:http2').ClientHttp2Stream}
|
||||
*/
|
||||
stream = session.request(headers, { endStream: shouldEndStream, signal })
|
||||
|
||||
stream.once('continue', writeBodyH2)
|
||||
} else {
|
||||
/** @type {import('node:http2').ClientHttp2Stream} */
|
||||
stream = session.request(headers, {
|
||||
endStream: shouldEndStream,
|
||||
signal
|
||||
@ -1782,9 +1796,7 @@ function writeH2 (client, session, request) {
|
||||
++h2State.openStreams
|
||||
|
||||
stream.once('response', headers => {
|
||||
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
|
||||
|
||||
if (request.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), '') === false) {
|
||||
if (request.onHeaders(Number(headers[HTTP2_HEADER_STATUS]), headers, stream.resume.bind(stream), '') === false) {
|
||||
stream.pause()
|
||||
}
|
||||
})
|
||||
@ -1794,17 +1806,13 @@ 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) {
|
||||
@ -1964,11 +1972,7 @@ function writeStream ({ h2stream, body, client, request, socket, contentLength,
|
||||
}
|
||||
}
|
||||
const onAbort = function () {
|
||||
if (finished) {
|
||||
return
|
||||
}
|
||||
const err = new RequestAbortedError()
|
||||
queueMicrotask(() => onFinished(err))
|
||||
onFinished(new RequestAbortedError())
|
||||
}
|
||||
const onFinished = function (err) {
|
||||
if (finished) {
|
||||
|
Reference in New Issue
Block a user