mirror of
https://github.com/robinraju/release-downloader.git
synced 2026-10-02 08:46:05 +03:00
chore: refresh dist [skip ci]
This commit is contained in:
1 parent
9e9bfde7a9
commit
23aed665ce
2 files changed
+306
-111
No files matched your search
+305
-110
@@ -2750,15 +2750,24 @@ function requireDispatcherBase () {
|
||||
const kOnDestroyed = Symbol('onDestroyed');
|
||||
const kOnClosed = Symbol('onClosed');
|
||||
const kInterceptedDispatch = Symbol('Intercepted Dispatch');
|
||||
const kWebSocketOptions = Symbol('webSocketOptions');
|
||||
|
||||
class DispatcherBase extends Dispatcher {
|
||||
constructor () {
|
||||
constructor (opts) {
|
||||
super();
|
||||
|
||||
this[kDestroyed] = false;
|
||||
this[kOnDestroyed] = null;
|
||||
this[kClosed] = false;
|
||||
this[kOnClosed] = [];
|
||||
this[kWebSocketOptions] = opts?.webSocket ?? {};
|
||||
}
|
||||
|
||||
get webSocketOptions () {
|
||||
return {
|
||||
maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
|
||||
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
|
||||
get destroyed () {
|
||||
@@ -8708,6 +8717,9 @@ function requireClientH1 () {
|
||||
const FastBuffer = Buffer[Symbol.species];
|
||||
const addListener = util.addListener;
|
||||
const removeAllListeners = util.removeAllListeners;
|
||||
const kIdleSocketValidation = Symbol('kIdleSocketValidation');
|
||||
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout');
|
||||
const kSocketUsed = Symbol('kSocketUsed');
|
||||
|
||||
let extractBody;
|
||||
|
||||
@@ -8930,29 +8942,71 @@ function requireClientH1 () {
|
||||
|
||||
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
|
||||
|
||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.onUpgrade(data.slice(offset));
|
||||
} else if (ret === constants.ERROR.PAUSED) {
|
||||
this.paused = true;
|
||||
socket.unshift(data.slice(offset));
|
||||
} else if (ret !== constants.ERROR.OK) {
|
||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
||||
let message = '';
|
||||
/* istanbul ignore else: difficult to make a test case for */
|
||||
if (ptr) {
|
||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
||||
message =
|
||||
'Response does not match the HTTP/1.1 protocol (' +
|
||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||
')';
|
||||
if (ret !== constants.ERROR.OK) {
|
||||
const body = data.subarray(offset);
|
||||
|
||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.onUpgrade(body);
|
||||
} else if (ret === constants.ERROR.PAUSED) {
|
||||
this.paused = true;
|
||||
socket.unshift(body);
|
||||
} else {
|
||||
throw this.createError(ret, body)
|
||||
}
|
||||
throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset))
|
||||
}
|
||||
} catch (err) {
|
||||
util.destroy(socket, err);
|
||||
}
|
||||
}
|
||||
|
||||
finish () {
|
||||
assert(currentParser === null);
|
||||
assert(this.ptr != null);
|
||||
assert(!this.paused);
|
||||
|
||||
const { llhttp } = this;
|
||||
|
||||
let ret;
|
||||
|
||||
try {
|
||||
currentParser = this;
|
||||
ret = llhttp.llhttp_finish(this.ptr);
|
||||
} finally {
|
||||
currentParser = null;
|
||||
}
|
||||
|
||||
if (ret === constants.ERROR.OK) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||
this.paused = true;
|
||||
return null
|
||||
}
|
||||
|
||||
return this.createError(ret, EMPTY_BUF)
|
||||
}
|
||||
|
||||
createError (ret, data) {
|
||||
const { llhttp, contentLength, bytesRead } = this;
|
||||
|
||||
if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
||||
return new ResponseContentLengthMismatchError()
|
||||
}
|
||||
|
||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
||||
let message = '';
|
||||
if (ptr) {
|
||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
||||
message =
|
||||
'Response does not match the HTTP/1.1 protocol (' +
|
||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||
')';
|
||||
}
|
||||
|
||||
return new HTTPParserError(message, constants.ERROR[ret], data)
|
||||
}
|
||||
|
||||
destroy () {
|
||||
assert(this.ptr != null);
|
||||
assert(currentParser == null);
|
||||
@@ -8980,6 +9034,11 @@ function requireClientH1 () {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)));
|
||||
return -1
|
||||
}
|
||||
|
||||
const request = client[kQueue][client[kRunningIdx]];
|
||||
if (!request) {
|
||||
return -1
|
||||
@@ -9083,6 +9142,11 @@ function requireClientH1 () {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)));
|
||||
return -1
|
||||
}
|
||||
|
||||
const request = client[kQueue][client[kRunningIdx]];
|
||||
|
||||
/* istanbul ignore next: difficult to make a test case for */
|
||||
@@ -9256,6 +9320,7 @@ function requireClientH1 () {
|
||||
request.onComplete(headers);
|
||||
|
||||
client[kQueue][client[kRunningIdx]++] = null;
|
||||
socket[kSocketUsed] = true;
|
||||
|
||||
if (socket[kWriting]) {
|
||||
assert(client[kRunning] === 0);
|
||||
@@ -9314,6 +9379,9 @@ function requireClientH1 () {
|
||||
socket[kWriting] = false;
|
||||
socket[kReset] = false;
|
||||
socket[kBlocking] = false;
|
||||
socket[kIdleSocketValidation] = 0;
|
||||
socket[kIdleSocketValidationTimeout] = null;
|
||||
socket[kSocketUsed] = false;
|
||||
socket[kParser] = new Parser(client, socket, llhttpInstance);
|
||||
|
||||
addListener(socket, 'error', function (err) {
|
||||
@@ -9324,8 +9392,11 @@ function requireClientH1 () {
|
||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||
// to the user.
|
||||
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so for as a valid response.
|
||||
parser.onMessageComplete();
|
||||
const parserErr = parser.finish();
|
||||
if (parserErr) {
|
||||
this[kError] = parserErr;
|
||||
this[kClient][kOnError](parserErr);
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -9344,8 +9415,10 @@ function requireClientH1 () {
|
||||
const parser = this[kParser];
|
||||
|
||||
if (parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so far as a valid response.
|
||||
parser.onMessageComplete();
|
||||
const parserErr = parser.finish();
|
||||
if (parserErr) {
|
||||
util.destroy(this, parserErr);
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -9355,10 +9428,11 @@ function requireClientH1 () {
|
||||
const client = this[kClient];
|
||||
const parser = this[kParser];
|
||||
|
||||
clearIdleSocketValidation(this);
|
||||
|
||||
if (parser) {
|
||||
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
||||
// We treat all incoming data so far as a valid response.
|
||||
parser.onMessageComplete();
|
||||
this[kError] = parser.finish() || this[kError];
|
||||
}
|
||||
|
||||
this[kParser].destroy();
|
||||
@@ -9421,7 +9495,7 @@ function requireClientH1 () {
|
||||
return socket.destroyed
|
||||
},
|
||||
busy (request) {
|
||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -9459,6 +9533,31 @@ function requireClientH1 () {
|
||||
}
|
||||
}
|
||||
|
||||
function clearIdleSocketValidation (socket) {
|
||||
if (socket[kIdleSocketValidationTimeout]) {
|
||||
clearTimeout(socket[kIdleSocketValidationTimeout]);
|
||||
socket[kIdleSocketValidationTimeout] = null;
|
||||
}
|
||||
|
||||
socket[kIdleSocketValidation] = 0;
|
||||
}
|
||||
|
||||
function scheduleIdleSocketValidation (client, socket) {
|
||||
socket[kIdleSocketValidation] = 1;
|
||||
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
||||
socket[kIdleSocketValidationTimeout] = null;
|
||||
socket[kIdleSocketValidation] = 2;
|
||||
|
||||
if (client[kSocket] === socket && !socket.destroyed) {
|
||||
client[kResume]();
|
||||
}
|
||||
}, 0);
|
||||
socket[kIdleSocketValidationTimeout].unref?.();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('./client.js')} client
|
||||
*/
|
||||
function resumeH1 (client) {
|
||||
const socket = client[kSocket];
|
||||
|
||||
@@ -9473,6 +9572,32 @@ function requireClientH1 () {
|
||||
socket[kNoRef] = false;
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
|
||||
if (socket[kIdleSocketValidation] === 0) {
|
||||
scheduleIdleSocketValidation(client, socket);
|
||||
socket[kParser].readMore();
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (socket[kIdleSocketValidation] === 1) {
|
||||
socket[kParser].readMore();
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (client[kRunning] === 0) {
|
||||
socket[kParser].readMore();
|
||||
if (socket.destroyed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (client[kSize] === 0) {
|
||||
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
|
||||
socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE);
|
||||
@@ -9566,6 +9691,7 @@ function requireClientH1 () {
|
||||
}
|
||||
|
||||
const socket = client[kSocket];
|
||||
clearIdleSocketValidation(socket);
|
||||
|
||||
const abort = (err) => {
|
||||
if (request.aborted || request.completed) {
|
||||
@@ -11136,9 +11262,10 @@ function requireClient () {
|
||||
autoSelectFamilyAttemptTimeout,
|
||||
// h2
|
||||
maxConcurrentStreams,
|
||||
allowH2
|
||||
allowH2,
|
||||
webSocket
|
||||
} = {}) {
|
||||
super();
|
||||
super({ webSocket });
|
||||
|
||||
if (keepAlive !== undefined) {
|
||||
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
||||
@@ -11845,8 +11972,8 @@ function requirePoolBase () {
|
||||
const kStats = Symbol('stats');
|
||||
|
||||
class PoolBase extends DispatcherBase {
|
||||
constructor () {
|
||||
super();
|
||||
constructor (opts) {
|
||||
super(opts);
|
||||
|
||||
this[kQueue] = new FixedQueue();
|
||||
this[kClients] = [];
|
||||
@@ -12065,8 +12192,6 @@ function requirePool () {
|
||||
allowH2,
|
||||
...options
|
||||
} = {}) {
|
||||
super();
|
||||
|
||||
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
|
||||
throw new InvalidArgumentError('invalid connections')
|
||||
}
|
||||
@@ -12091,6 +12216,8 @@ function requirePool () {
|
||||
});
|
||||
}
|
||||
|
||||
super(options);
|
||||
|
||||
this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
|
||||
? options.interceptors.Pool
|
||||
: [];
|
||||
@@ -12384,8 +12511,6 @@ function requireAgent () {
|
||||
|
||||
class Agent extends DispatcherBase {
|
||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||
super();
|
||||
|
||||
if (typeof factory !== 'function') {
|
||||
throw new InvalidArgumentError('factory must be a function.')
|
||||
}
|
||||
@@ -12398,6 +12523,8 @@ function requireAgent () {
|
||||
throw new InvalidArgumentError('maxRedirections must be a positive number')
|
||||
}
|
||||
|
||||
super(options);
|
||||
|
||||
if (connect && typeof connect !== 'function') {
|
||||
connect = { ...connect };
|
||||
}
|
||||
@@ -24047,32 +24174,25 @@ function requireParse$1 () {
|
||||
// If the attribute-name case-insensitively matches the string
|
||||
// "SameSite", the user agent MUST process the cookie-av as follows:
|
||||
|
||||
// 1. Let enforcement be "Default".
|
||||
let enforcement = 'Default';
|
||||
|
||||
const attributeValueLowercase = attributeValue.toLowerCase();
|
||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "None", set enforcement to "None".
|
||||
if (attributeValueLowercase.includes('none')) {
|
||||
enforcement = 'None';
|
||||
}
|
||||
|
||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Strict", set enforcement to "Strict".
|
||||
if (attributeValueLowercase.includes('strict')) {
|
||||
enforcement = 'Strict';
|
||||
// 1. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "None", append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of "None".
|
||||
if (attributeValueLowercase === 'none') {
|
||||
cookieAttributeList.sameSite = 'None';
|
||||
} else if (attributeValueLowercase === 'strict') {
|
||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Strict", append an attribute to the cookie-attribute-list with
|
||||
// an attribute-name of "SameSite" and an attribute-value of
|
||||
// "Strict".
|
||||
cookieAttributeList.sameSite = 'Strict';
|
||||
} else if (attributeValueLowercase === 'lax') {
|
||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Lax", append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of "Lax".
|
||||
cookieAttributeList.sameSite = 'Lax';
|
||||
}
|
||||
|
||||
// 4. If cookie-av's attribute-value is a case-insensitive match for
|
||||
// "Lax", set enforcement to "Lax".
|
||||
if (attributeValueLowercase.includes('lax')) {
|
||||
enforcement = 'Lax';
|
||||
}
|
||||
|
||||
// 5. Append an attribute to the cookie-attribute-list with an
|
||||
// attribute-name of "SameSite" and an attribute-value of
|
||||
// enforcement.
|
||||
cookieAttributeList.sameSite = enforcement;
|
||||
} else {
|
||||
cookieAttributeList.unparsed ??= [];
|
||||
|
||||
@@ -25538,40 +25658,35 @@ function requirePermessageDeflate () {
|
||||
const kBuffer = Symbol('kBuffer');
|
||||
const kLength = Symbol('kLength');
|
||||
|
||||
// Default maximum decompressed message size: 4 MB
|
||||
const kDefaultMaxDecompressedSize = 4 * 1024 * 1024;
|
||||
|
||||
class PerMessageDeflate {
|
||||
/** @type {import('node:zlib').InflateRaw} */
|
||||
#inflate
|
||||
|
||||
#options = {}
|
||||
|
||||
/** @type {boolean} */
|
||||
#aborted = false
|
||||
|
||||
/** @type {Function|null} */
|
||||
#currentCallback = null
|
||||
#maxPayloadSize = 0
|
||||
|
||||
/**
|
||||
* @param {Map<string, string>} extensions
|
||||
*/
|
||||
constructor (extensions) {
|
||||
constructor (extensions, options) {
|
||||
this.#options.serverNoContextTakeover = extensions.has('server_no_context_takeover');
|
||||
this.#options.serverMaxWindowBits = extensions.get('server_max_window_bits');
|
||||
|
||||
this.#maxPayloadSize = options.maxPayloadSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress a compressed payload.
|
||||
* @param {Buffer} chunk Compressed data
|
||||
* @param {boolean} fin Final fragment flag
|
||||
* @param {Function} callback Callback function
|
||||
*/
|
||||
decompress (chunk, fin, callback) {
|
||||
// An endpoint uses the following algorithm to decompress a message.
|
||||
// 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the
|
||||
// payload of the message.
|
||||
// 2. Decompress the resulting data using DEFLATE.
|
||||
|
||||
if (this.#aborted) {
|
||||
callback(new MessageSizeExceededError());
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.#inflate) {
|
||||
let windowBits = Z_DEFAULT_WINDOWBITS;
|
||||
|
||||
@@ -25594,23 +25709,12 @@ function requirePermessageDeflate () {
|
||||
this.#inflate[kLength] = 0;
|
||||
|
||||
this.#inflate.on('data', (data) => {
|
||||
if (this.#aborted) {
|
||||
return
|
||||
}
|
||||
|
||||
this.#inflate[kLength] += data.length;
|
||||
|
||||
if (this.#inflate[kLength] > kDefaultMaxDecompressedSize) {
|
||||
this.#aborted = true;
|
||||
if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
|
||||
callback(new MessageSizeExceededError());
|
||||
this.#inflate.removeAllListeners();
|
||||
this.#inflate.destroy();
|
||||
this.#inflate = null;
|
||||
|
||||
if (this.#currentCallback) {
|
||||
const cb = this.#currentCallback;
|
||||
this.#currentCallback = null;
|
||||
cb(new MessageSizeExceededError());
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -25623,14 +25727,13 @@ function requirePermessageDeflate () {
|
||||
});
|
||||
}
|
||||
|
||||
this.#currentCallback = callback;
|
||||
this.#inflate.write(chunk);
|
||||
if (fin) {
|
||||
this.#inflate.write(tail);
|
||||
}
|
||||
|
||||
this.#inflate.flush(() => {
|
||||
if (this.#aborted || !this.#inflate) {
|
||||
if (!this.#inflate) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -25638,7 +25741,6 @@ function requirePermessageDeflate () {
|
||||
|
||||
this.#inflate[kBuffer].length = 0;
|
||||
this.#inflate[kLength] = 0;
|
||||
this.#currentCallback = null;
|
||||
|
||||
callback(null, full);
|
||||
});
|
||||
@@ -25674,6 +25776,12 @@ function requireReceiver () {
|
||||
const { WebsocketFrameSend } = requireFrame();
|
||||
const { closeWebSocketConnection } = requireConnection();
|
||||
const { PerMessageDeflate } = requirePermessageDeflate();
|
||||
const { MessageSizeExceededError } = requireErrors();
|
||||
|
||||
function failWebsocketConnectionWithCode (ws, code, reason) {
|
||||
closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason));
|
||||
failWebsocketConnection(ws, reason);
|
||||
}
|
||||
|
||||
// This code was influenced by ws released under the MIT license.
|
||||
// Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
||||
@@ -25682,6 +25790,7 @@ function requireReceiver () {
|
||||
|
||||
class ByteParser extends Writable {
|
||||
#buffers = []
|
||||
#fragmentsBytes = 0
|
||||
#byteOffset = 0
|
||||
#loop = false
|
||||
|
||||
@@ -25693,18 +25802,27 @@ function requireReceiver () {
|
||||
/** @type {Map<string, PerMessageDeflate>} */
|
||||
#extensions
|
||||
|
||||
/** @type {number} */
|
||||
#maxFragments
|
||||
|
||||
/** @type {number} */
|
||||
#maxPayloadSize
|
||||
|
||||
/**
|
||||
* @param {import('./websocket').WebSocket} ws
|
||||
* @param {Map<string, string>|null} extensions
|
||||
* @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
|
||||
*/
|
||||
constructor (ws, extensions) {
|
||||
constructor (ws, extensions, options = {}) {
|
||||
super();
|
||||
|
||||
this.ws = ws;
|
||||
this.#extensions = extensions == null ? new Map() : extensions;
|
||||
this.#maxFragments = options.maxFragments ?? 0;
|
||||
this.#maxPayloadSize = options.maxPayloadSize ?? 0;
|
||||
|
||||
if (this.#extensions.has('permessage-deflate')) {
|
||||
this.#extensions.set('permessage-deflate', new PerMessageDeflate(extensions));
|
||||
this.#extensions.set('permessage-deflate', new PerMessageDeflate(extensions, options));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25720,6 +25838,19 @@ function requireReceiver () {
|
||||
this.run(callback);
|
||||
}
|
||||
|
||||
#validatePayloadLength () {
|
||||
if (
|
||||
this.#maxPayloadSize > 0 &&
|
||||
!isControlFrame(this.#info.opcode) &&
|
||||
this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
|
||||
) {
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, 'Payload size exceeds maximum allowed size');
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs whenever a new chunk is received.
|
||||
* Callback is called whenever there are no more chunks buffering,
|
||||
@@ -25808,6 +25939,10 @@ function requireReceiver () {
|
||||
if (payloadLength <= 125) {
|
||||
this.#info.payloadLength = payloadLength;
|
||||
this.#state = parserStates.READ_DATA;
|
||||
|
||||
if (!this.#validatePayloadLength()) {
|
||||
return
|
||||
}
|
||||
} else if (payloadLength === 126) {
|
||||
this.#state = parserStates.PAYLOADLENGTH_16;
|
||||
} else if (payloadLength === 127) {
|
||||
@@ -25832,6 +25967,10 @@ function requireReceiver () {
|
||||
|
||||
this.#info.payloadLength = buffer.readUInt16BE(0);
|
||||
this.#state = parserStates.READ_DATA;
|
||||
|
||||
if (!this.#validatePayloadLength()) {
|
||||
return
|
||||
}
|
||||
} else if (this.#state === parserStates.PAYLOADLENGTH_64) {
|
||||
if (this.#byteOffset < 8) {
|
||||
return callback()
|
||||
@@ -25854,6 +25993,10 @@ function requireReceiver () {
|
||||
|
||||
this.#info.payloadLength = lower;
|
||||
this.#state = parserStates.READ_DATA;
|
||||
|
||||
if (!this.#validatePayloadLength()) {
|
||||
return
|
||||
}
|
||||
} else if (this.#state === parserStates.READ_DATA) {
|
||||
if (this.#byteOffset < this.#info.payloadLength) {
|
||||
return callback()
|
||||
@@ -25866,42 +26009,58 @@ function requireReceiver () {
|
||||
this.#state = parserStates.INFO;
|
||||
} else {
|
||||
if (!this.#info.compressed) {
|
||||
this.#fragments.push(body);
|
||||
if (!this.writeFragments(body)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message);
|
||||
return
|
||||
}
|
||||
|
||||
// If the frame is not fragmented, a message has been received.
|
||||
// If the frame is fragmented, it will terminate with a fin bit set
|
||||
// and an opcode of 0 (continuation), therefore we handle that when
|
||||
// parsing continuation frames, not here.
|
||||
if (!this.#info.fragmented && this.#info.fin) {
|
||||
const fullMessage = Buffer.concat(this.#fragments);
|
||||
websocketMessageReceived(this.ws, this.#info.binaryType, fullMessage);
|
||||
this.#fragments.length = 0;
|
||||
websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
|
||||
}
|
||||
|
||||
this.#state = parserStates.INFO;
|
||||
} else {
|
||||
this.#extensions.get('permessage-deflate').decompress(body, this.#info.fin, (error, data) => {
|
||||
if (error) {
|
||||
failWebsocketConnection(this.ws, error.message);
|
||||
return
|
||||
}
|
||||
this.#extensions.get('permessage-deflate').decompress(
|
||||
body,
|
||||
this.#info.fin,
|
||||
(error, data) => {
|
||||
if (error) {
|
||||
const code = error instanceof MessageSizeExceededError ? 1009 : 1007;
|
||||
failWebsocketConnectionWithCode(this.ws, code, error.message);
|
||||
return
|
||||
}
|
||||
|
||||
this.#fragments.push(data);
|
||||
if (!this.writeFragments(data)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message);
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.#info.fin) {
|
||||
this.#state = parserStates.INFO;
|
||||
this.#loop = true;
|
||||
this.run(callback);
|
||||
return
|
||||
}
|
||||
|
||||
websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
|
||||
|
||||
if (!this.#info.fin) {
|
||||
this.#state = parserStates.INFO;
|
||||
this.#loop = true;
|
||||
this.#state = parserStates.INFO;
|
||||
this.run(callback);
|
||||
return
|
||||
}
|
||||
|
||||
websocketMessageReceived(this.ws, this.#info.binaryType, Buffer.concat(this.#fragments));
|
||||
|
||||
this.#loop = true;
|
||||
this.#state = parserStates.INFO;
|
||||
this.#fragments.length = 0;
|
||||
this.run(callback);
|
||||
});
|
||||
);
|
||||
|
||||
this.#loop = false;
|
||||
break
|
||||
@@ -25953,6 +26112,35 @@ function requireReceiver () {
|
||||
return buffer
|
||||
}
|
||||
|
||||
writeFragments (fragment) {
|
||||
if (
|
||||
this.#maxFragments > 0 &&
|
||||
this.#fragments.length === this.#maxFragments
|
||||
) {
|
||||
failWebsocketConnectionWithCode(this.ws, 1008, 'Too many message fragments');
|
||||
return false
|
||||
}
|
||||
|
||||
this.#fragmentsBytes += fragment.length;
|
||||
this.#fragments.push(fragment);
|
||||
return true
|
||||
}
|
||||
|
||||
consumeFragments () {
|
||||
const fragments = this.#fragments;
|
||||
|
||||
if (fragments.length === 1) {
|
||||
this.#fragmentsBytes = 0;
|
||||
return fragments.shift()
|
||||
}
|
||||
|
||||
const output = Buffer.concat(fragments, this.#fragmentsBytes);
|
||||
this.#fragments = [];
|
||||
this.#fragmentsBytes = 0;
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
parseCloseBody (data) {
|
||||
assert(data.length !== 1);
|
||||
|
||||
@@ -26638,7 +26826,14 @@ function requireWebsocket () {
|
||||
// once this happens, the connection is open
|
||||
this[kResponse] = response;
|
||||
|
||||
const parser = new ByteParser(this, parsedExtensions);
|
||||
const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions;
|
||||
const maxFragments = webSocketOptions?.maxFragments;
|
||||
const maxPayloadSize = webSocketOptions?.maxPayloadSize;
|
||||
|
||||
const parser = new ByteParser(this, parsedExtensions, {
|
||||
maxFragments,
|
||||
maxPayloadSize
|
||||
});
|
||||
parser.on('drain', onParserDrain);
|
||||
parser.on('error', onParserError.bind(this));
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../node_modules/@actions/core/lib/utils.js","../node_modules/@actions/core/lib/command.js","../node_modules/@actions/core/lib/file-command.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/tunnel/index.js","../node_modules/undici/lib/core/symbols.js","../node_modules/undici/lib/core/errors.js","../node_modules/undici/lib/core/constants.js","../node_modules/undici/lib/core/tree.js","../node_modules/undici/lib/core/util.js","../node_modules/undici/lib/core/diagnostics.js","../node_modules/undici/lib/core/request.js","../node_modules/undici/lib/dispatcher/dispatcher.js","../node_modules/undici/lib/dispatcher/dispatcher-base.js","../node_modules/undici/lib/util/timers.js","../node_modules/undici/lib/core/connect.js","../node_modules/undici/lib/llhttp/utils.js","../node_modules/undici/lib/llhttp/constants.js","../node_modules/undici/lib/llhttp/llhttp-wasm.js","../node_modules/undici/lib/llhttp/llhttp_simd-wasm.js","../node_modules/undici/lib/web/fetch/constants.js","../node_modules/undici/lib/web/fetch/global.js","../node_modules/undici/lib/web/fetch/data-url.js","../node_modules/undici/lib/web/fetch/webidl.js","../node_modules/undici/lib/web/fetch/util.js","../node_modules/undici/lib/web/fetch/symbols.js","../node_modules/undici/lib/web/fetch/file.js","../node_modules/undici/lib/web/fetch/formdata.js","../node_modules/undici/lib/web/fetch/formdata-parser.js","../node_modules/undici/lib/web/fetch/body.js","../node_modules/undici/lib/dispatcher/client-h1.js","../node_modules/undici/lib/dispatcher/client-h2.js","../node_modules/undici/lib/handler/redirect-handler.js","../node_modules/undici/lib/interceptor/redirect-interceptor.js","../node_modules/undici/lib/dispatcher/client.js","../node_modules/undici/lib/dispatcher/fixed-queue.js","../node_modules/undici/lib/dispatcher/pool-stats.js","../node_modules/undici/lib/dispatcher/pool-base.js","../node_modules/undici/lib/dispatcher/pool.js","../node_modules/undici/lib/dispatcher/balanced-pool.js","../node_modules/undici/lib/dispatcher/agent.js","../node_modules/undici/lib/dispatcher/proxy-agent.js","../node_modules/undici/lib/dispatcher/env-http-proxy-agent.js","../node_modules/undici/lib/handler/retry-handler.js","../node_modules/undici/lib/dispatcher/retry-agent.js","../node_modules/undici/lib/api/readable.js","../node_modules/undici/lib/api/util.js","../node_modules/undici/lib/api/api-request.js","../node_modules/undici/lib/api/abort-signal.js","../node_modules/undici/lib/api/api-stream.js","../node_modules/undici/lib/api/api-pipeline.js","../node_modules/undici/lib/api/api-upgrade.js","../node_modules/undici/lib/api/api-connect.js","../node_modules/undici/lib/api/index.js","../node_modules/undici/lib/mock/mock-errors.js","../node_modules/undici/lib/mock/mock-symbols.js","../node_modules/undici/lib/mock/mock-utils.js","../node_modules/undici/lib/mock/mock-interceptor.js","../node_modules/undici/lib/mock/mock-client.js","../node_modules/undici/lib/mock/mock-pool.js","../node_modules/undici/lib/mock/pluralizer.js","../node_modules/undici/lib/mock/pending-interceptors-formatter.js","../node_modules/undici/lib/mock/mock-agent.js","../node_modules/undici/lib/global.js","../node_modules/undici/lib/handler/decorator-handler.js","../node_modules/undici/lib/interceptor/redirect.js","../node_modules/undici/lib/interceptor/retry.js","../node_modules/undici/lib/interceptor/dump.js","../node_modules/undici/lib/interceptor/dns.js","../node_modules/undici/lib/web/fetch/headers.js","../node_modules/undici/lib/web/fetch/response.js","../node_modules/undici/lib/web/fetch/dispatcher-weakref.js","../node_modules/undici/lib/web/fetch/request.js","../node_modules/undici/lib/web/fetch/index.js","../node_modules/undici/lib/web/fileapi/symbols.js","../node_modules/undici/lib/web/fileapi/progressevent.js","../node_modules/undici/lib/web/fileapi/encoding.js","../node_modules/undici/lib/web/fileapi/util.js","../node_modules/undici/lib/web/fileapi/filereader.js","../node_modules/undici/lib/web/cache/symbols.js","../node_modules/undici/lib/web/cache/util.js","../node_modules/undici/lib/web/cache/cache.js","../node_modules/undici/lib/web/cache/cachestorage.js","../node_modules/undici/lib/web/cookies/constants.js","../node_modules/undici/lib/web/cookies/util.js","../node_modules/undici/lib/web/cookies/parse.js","../node_modules/undici/lib/web/cookies/index.js","../node_modules/undici/lib/web/websocket/events.js","../node_modules/undici/lib/web/websocket/constants.js","../node_modules/undici/lib/web/websocket/symbols.js","../node_modules/undici/lib/web/websocket/util.js","../node_modules/undici/lib/web/websocket/frame.js","../node_modules/undici/lib/web/websocket/connection.js","../node_modules/undici/lib/web/websocket/permessage-deflate.js","../node_modules/undici/lib/web/websocket/receiver.js","../node_modules/undici/lib/web/websocket/sender.js","../node_modules/undici/lib/web/websocket/websocket.js","../node_modules/undici/lib/web/eventsourceLine truncated
|
||||
{"version":3,"file":"index.js","sources":["../node_modules/@actions/core/lib/utils.js","../node_modules/@actions/core/lib/command.js","../node_modules/@actions/core/lib/file-command.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/tunnel/index.js","../node_modules/undici/lib/core/symbols.js","../node_modules/undici/lib/core/errors.js","../node_modules/undici/lib/core/constants.js","../node_modules/undici/lib/core/tree.js","../node_modules/undici/lib/core/util.js","../node_modules/undici/lib/core/diagnostics.js","../node_modules/undici/lib/core/request.js","../node_modules/undici/lib/dispatcher/dispatcher.js","../node_modules/undici/lib/dispatcher/dispatcher-base.js","../node_modules/undici/lib/util/timers.js","../node_modules/undici/lib/core/connect.js","../node_modules/undici/lib/llhttp/utils.js","../node_modules/undici/lib/llhttp/constants.js","../node_modules/undici/lib/llhttp/llhttp-wasm.js","../node_modules/undici/lib/llhttp/llhttp_simd-wasm.js","../node_modules/undici/lib/web/fetch/constants.js","../node_modules/undici/lib/web/fetch/global.js","../node_modules/undici/lib/web/fetch/data-url.js","../node_modules/undici/lib/web/fetch/webidl.js","../node_modules/undici/lib/web/fetch/util.js","../node_modules/undici/lib/web/fetch/symbols.js","../node_modules/undici/lib/web/fetch/file.js","../node_modules/undici/lib/web/fetch/formdata.js","../node_modules/undici/lib/web/fetch/formdata-parser.js","../node_modules/undici/lib/web/fetch/body.js","../node_modules/undici/lib/dispatcher/client-h1.js","../node_modules/undici/lib/dispatcher/client-h2.js","../node_modules/undici/lib/handler/redirect-handler.js","../node_modules/undici/lib/interceptor/redirect-interceptor.js","../node_modules/undici/lib/dispatcher/client.js","../node_modules/undici/lib/dispatcher/fixed-queue.js","../node_modules/undici/lib/dispatcher/pool-stats.js","../node_modules/undici/lib/dispatcher/pool-base.js","../node_modules/undici/lib/dispatcher/pool.js","../node_modules/undici/lib/dispatcher/balanced-pool.js","../node_modules/undici/lib/dispatcher/agent.js","../node_modules/undici/lib/dispatcher/proxy-agent.js","../node_modules/undici/lib/dispatcher/env-http-proxy-agent.js","../node_modules/undici/lib/handler/retry-handler.js","../node_modules/undici/lib/dispatcher/retry-agent.js","../node_modules/undici/lib/api/readable.js","../node_modules/undici/lib/api/util.js","../node_modules/undici/lib/api/api-request.js","../node_modules/undici/lib/api/abort-signal.js","../node_modules/undici/lib/api/api-stream.js","../node_modules/undici/lib/api/api-pipeline.js","../node_modules/undici/lib/api/api-upgrade.js","../node_modules/undici/lib/api/api-connect.js","../node_modules/undici/lib/api/index.js","../node_modules/undici/lib/mock/mock-errors.js","../node_modules/undici/lib/mock/mock-symbols.js","../node_modules/undici/lib/mock/mock-utils.js","../node_modules/undici/lib/mock/mock-interceptor.js","../node_modules/undici/lib/mock/mock-client.js","../node_modules/undici/lib/mock/mock-pool.js","../node_modules/undici/lib/mock/pluralizer.js","../node_modules/undici/lib/mock/pending-interceptors-formatter.js","../node_modules/undici/lib/mock/mock-agent.js","../node_modules/undici/lib/global.js","../node_modules/undici/lib/handler/decorator-handler.js","../node_modules/undici/lib/interceptor/redirect.js","../node_modules/undici/lib/interceptor/retry.js","../node_modules/undici/lib/interceptor/dump.js","../node_modules/undici/lib/interceptor/dns.js","../node_modules/undici/lib/web/fetch/headers.js","../node_modules/undici/lib/web/fetch/response.js","../node_modules/undici/lib/web/fetch/dispatcher-weakref.js","../node_modules/undici/lib/web/fetch/request.js","../node_modules/undici/lib/web/fetch/index.js","../node_modules/undici/lib/web/fileapi/symbols.js","../node_modules/undici/lib/web/fileapi/progressevent.js","../node_modules/undici/lib/web/fileapi/encoding.js","../node_modules/undici/lib/web/fileapi/util.js","../node_modules/undici/lib/web/fileapi/filereader.js","../node_modules/undici/lib/web/cache/symbols.js","../node_modules/undici/lib/web/cache/util.js","../node_modules/undici/lib/web/cache/cache.js","../node_modules/undici/lib/web/cache/cachestorage.js","../node_modules/undici/lib/web/cookies/constants.js","../node_modules/undici/lib/web/cookies/util.js","../node_modules/undici/lib/web/cookies/parse.js","../node_modules/undici/lib/web/cookies/index.js","../node_modules/undici/lib/web/websocket/events.js","../node_modules/undici/lib/web/websocket/constants.js","../node_modules/undici/lib/web/websocket/symbols.js","../node_modules/undici/lib/web/websocket/util.js","../node_modules/undici/lib/web/websocket/frame.js","../node_modules/undici/lib/web/websocket/connection.js","../node_modules/undici/lib/web/websocket/permessage-deflate.js","../node_modules/undici/lib/web/websocket/receiver.js","../node_modules/undici/lib/web/websocket/sender.js","../node_modules/undici/lib/web/websocket/websocket.js","../node_modules/undici/lib/web/eventsourceLine truncated
|
||||
Reference in new issue
Block a user