@node9/proxy 2.37.0 → 2.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +649 -230
- package/dist/cli.mjs +649 -230
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39620,6 +39620,7 @@ var require_symbols = __commonJS({
|
|
|
39620
39620
|
kDestroy: /* @__PURE__ */ Symbol("destroy"),
|
|
39621
39621
|
kDispatch: /* @__PURE__ */ Symbol("dispatch"),
|
|
39622
39622
|
kUrl: /* @__PURE__ */ Symbol("url"),
|
|
39623
|
+
kRedirectCacheControl: /* @__PURE__ */ Symbol("redirect cache control"),
|
|
39623
39624
|
kWriting: /* @__PURE__ */ Symbol("writing"),
|
|
39624
39625
|
kResuming: /* @__PURE__ */ Symbol("resuming"),
|
|
39625
39626
|
kQueue: /* @__PURE__ */ Symbol("queue"),
|
|
@@ -41914,10 +41915,27 @@ var require_request = __commonJS({
|
|
|
41914
41915
|
return false;
|
|
41915
41916
|
}
|
|
41916
41917
|
}
|
|
41917
|
-
|
|
41918
|
+
/**
|
|
41919
|
+
* @param {number} statusCode
|
|
41920
|
+
* @param {Buffer[]|string[]} headers
|
|
41921
|
+
* @param {import('node:stream').Duplex} socket
|
|
41922
|
+
* @param {string} [statusText]
|
|
41923
|
+
*/
|
|
41924
|
+
onUpgrade(statusCode, headers, socket, statusText = "") {
|
|
41925
|
+
this.onFinally();
|
|
41918
41926
|
assert(!this.aborted);
|
|
41919
41927
|
assert(!this.completed);
|
|
41920
|
-
|
|
41928
|
+
if (channels.headers.hasSubscribers) {
|
|
41929
|
+
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
|
|
41930
|
+
}
|
|
41931
|
+
const result = this[kHandler].onUpgrade(statusCode, headers, socket);
|
|
41932
|
+
if (!this.aborted) {
|
|
41933
|
+
this.completed = true;
|
|
41934
|
+
if (channels.trailers.hasSubscribers) {
|
|
41935
|
+
channels.trailers.publish({ request: this, trailers: [] });
|
|
41936
|
+
}
|
|
41937
|
+
}
|
|
41938
|
+
return result;
|
|
41921
41939
|
}
|
|
41922
41940
|
onComplete(trailers) {
|
|
41923
41941
|
this.onFinally();
|
|
@@ -42267,6 +42285,7 @@ var require_unwrap_handler = __commonJS({
|
|
|
42267
42285
|
var require_dispatcher_base = __commonJS({
|
|
42268
42286
|
"node_modules/undici/lib/dispatcher/dispatcher-base.js"(exports2, module2) {
|
|
42269
42287
|
"use strict";
|
|
42288
|
+
var buffer = require("buffer");
|
|
42270
42289
|
var Dispatcher = require_dispatcher();
|
|
42271
42290
|
var UnwrapHandler = require_unwrap_handler();
|
|
42272
42291
|
var {
|
|
@@ -42278,6 +42297,7 @@ var require_dispatcher_base = __commonJS({
|
|
|
42278
42297
|
var kOnDestroyed = /* @__PURE__ */ Symbol("onDestroyed");
|
|
42279
42298
|
var kOnClosed = /* @__PURE__ */ Symbol("onClosed");
|
|
42280
42299
|
var kWebSocketOptions = /* @__PURE__ */ Symbol("webSocketOptions");
|
|
42300
|
+
var kEventSourceOptions = /* @__PURE__ */ Symbol("eventSourceOptions");
|
|
42281
42301
|
var DispatcherBase = class extends Dispatcher {
|
|
42282
42302
|
/** @type {boolean} */
|
|
42283
42303
|
[kDestroyed] = false;
|
|
@@ -42293,6 +42313,7 @@ var require_dispatcher_base = __commonJS({
|
|
|
42293
42313
|
constructor(opts) {
|
|
42294
42314
|
super();
|
|
42295
42315
|
this[kWebSocketOptions] = opts?.webSocket ?? {};
|
|
42316
|
+
this[kEventSourceOptions] = opts?.eventSource ?? {};
|
|
42296
42317
|
}
|
|
42297
42318
|
/**
|
|
42298
42319
|
* @returns {import('../../types/dispatcher').WebSocketOptions}
|
|
@@ -42304,6 +42325,14 @@ var require_dispatcher_base = __commonJS({
|
|
|
42304
42325
|
// 128 MB default
|
|
42305
42326
|
};
|
|
42306
42327
|
}
|
|
42328
|
+
/**
|
|
42329
|
+
* @returns {import('../../types/client').Client.EventSourceOptions}
|
|
42330
|
+
*/
|
|
42331
|
+
get eventSourceOptions() {
|
|
42332
|
+
return {
|
|
42333
|
+
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
|
|
42334
|
+
};
|
|
42335
|
+
}
|
|
42307
42336
|
/** @returns {boolean} */
|
|
42308
42337
|
get destroyed() {
|
|
42309
42338
|
return this[kDestroyed];
|
|
@@ -42449,15 +42478,19 @@ var require_connect = __commonJS({
|
|
|
42449
42478
|
if (this._sessionCache.has(sessionKey)) {
|
|
42450
42479
|
this._sessionCache.delete(sessionKey);
|
|
42451
42480
|
} else if (this._sessionCache.size >= this._maxCachedSessions) {
|
|
42481
|
+
let evicted = false;
|
|
42452
42482
|
for (const [key, ref] of this._sessionCache) {
|
|
42453
42483
|
if (ref.deref() === void 0) {
|
|
42454
42484
|
this._sessionCache.delete(key);
|
|
42455
|
-
|
|
42485
|
+
evicted = true;
|
|
42486
|
+
break;
|
|
42456
42487
|
}
|
|
42457
42488
|
}
|
|
42458
|
-
|
|
42459
|
-
|
|
42460
|
-
|
|
42489
|
+
if (!evicted) {
|
|
42490
|
+
const oldest = this._sessionCache.keys().next();
|
|
42491
|
+
if (!oldest.done) {
|
|
42492
|
+
this._sessionCache.delete(oldest.value);
|
|
42493
|
+
}
|
|
42461
42494
|
}
|
|
42462
42495
|
}
|
|
42463
42496
|
this._sessionCache.set(sessionKey, new WeakRef(session));
|
|
@@ -43516,6 +43549,10 @@ var require_infra = __commonJS({
|
|
|
43516
43549
|
return input.slice(start, position.position);
|
|
43517
43550
|
}
|
|
43518
43551
|
var ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g;
|
|
43552
|
+
var nonASCIIRegex = /[^\x00-\x7F]/;
|
|
43553
|
+
function asciiLowercase(str2) {
|
|
43554
|
+
return nonASCIIRegex.test(str2) ? str2.replace(/[A-Z]+/g, (upper) => upper.toLowerCase()) : str2.toLowerCase();
|
|
43555
|
+
}
|
|
43519
43556
|
function forgivingBase64(data) {
|
|
43520
43557
|
data = data.replace(ASCII_WHITESPACE_REPLACE_REGEX, "");
|
|
43521
43558
|
let dataLength = data.length;
|
|
@@ -43590,6 +43627,7 @@ var require_infra = __commonJS({
|
|
|
43590
43627
|
return result;
|
|
43591
43628
|
}
|
|
43592
43629
|
module2.exports = {
|
|
43630
|
+
asciiLowercase,
|
|
43593
43631
|
collectASequenceOfCodePoints,
|
|
43594
43632
|
collectASequenceOfCodePointsFast,
|
|
43595
43633
|
forgivingBase64,
|
|
@@ -46214,7 +46252,13 @@ var require_client_h1 = __commonJS({
|
|
|
46214
46252
|
function lazyllhttp() {
|
|
46215
46253
|
const llhttpWasmData = process.env.JEST_WORKER_ID ? require_llhttp_wasm() : void 0;
|
|
46216
46254
|
let mod;
|
|
46217
|
-
let useWasmSIMD =
|
|
46255
|
+
let useWasmSIMD = true;
|
|
46256
|
+
if (process.arch === "ppc64") {
|
|
46257
|
+
const [major, minor] = process.versions.node.split(".").map((n) => parseInt(n, 10));
|
|
46258
|
+
if (major < 24 || major === 24 && minor < 12) {
|
|
46259
|
+
useWasmSIMD = false;
|
|
46260
|
+
}
|
|
46261
|
+
}
|
|
46218
46262
|
if (process.env.UNDICI_NO_WASM_SIMD === "1") {
|
|
46219
46263
|
useWasmSIMD = false;
|
|
46220
46264
|
} else if (process.env.UNDICI_NO_WASM_SIMD === "0") {
|
|
@@ -46568,7 +46612,7 @@ var require_client_h1 = __commonJS({
|
|
|
46568
46612
|
* @param {Buffer} head
|
|
46569
46613
|
*/
|
|
46570
46614
|
onUpgrade(head) {
|
|
46571
|
-
const { upgrade, client, socket, headers, statusCode } = this;
|
|
46615
|
+
const { upgrade, client, socket, headers, statusCode, statusText } = this;
|
|
46572
46616
|
assert(upgrade);
|
|
46573
46617
|
assert(client[kSocket] === socket);
|
|
46574
46618
|
assert(!socket.destroyed);
|
|
@@ -46593,8 +46637,9 @@ var require_client_h1 = __commonJS({
|
|
|
46593
46637
|
client[kQueue][client[kRunningIdx]++] = null;
|
|
46594
46638
|
client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade"));
|
|
46595
46639
|
try {
|
|
46596
|
-
request2.onUpgrade(statusCode, headers, socket);
|
|
46640
|
+
request2.onUpgrade(statusCode, headers, socket, statusText);
|
|
46597
46641
|
} catch (err2) {
|
|
46642
|
+
util.errorRequest(client, request2, err2);
|
|
46598
46643
|
util.destroy(socket, err2);
|
|
46599
46644
|
}
|
|
46600
46645
|
client[kResume]();
|
|
@@ -46862,7 +46907,6 @@ var require_client_h1 = __commonJS({
|
|
|
46862
46907
|
};
|
|
46863
46908
|
}
|
|
46864
46909
|
function onHttpSocketError(err2) {
|
|
46865
|
-
assert(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
46866
46910
|
const parser = this[kParser];
|
|
46867
46911
|
if (err2.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
|
|
46868
46912
|
const parserErr = parser.finish();
|
|
@@ -47642,7 +47686,6 @@ var require_client_h2 = __commonJS({
|
|
|
47642
47686
|
}
|
|
47643
47687
|
}
|
|
47644
47688
|
function onHttp2SessionError(err2) {
|
|
47645
|
-
assert(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
47646
47689
|
this[kSocket][kError] = err2;
|
|
47647
47690
|
this[kClient][kOnError](err2);
|
|
47648
47691
|
}
|
|
@@ -47732,7 +47775,6 @@ var require_client_h2 = __commonJS({
|
|
|
47732
47775
|
client[kResume]();
|
|
47733
47776
|
}
|
|
47734
47777
|
function onHttp2SocketError(err2) {
|
|
47735
|
-
assert(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
47736
47778
|
this[kError] = err2;
|
|
47737
47779
|
this[kClient][kOnError](err2);
|
|
47738
47780
|
}
|
|
@@ -47826,10 +47868,15 @@ var require_client_h2 = __commonJS({
|
|
|
47826
47868
|
}
|
|
47827
47869
|
stream = session.request(headers, { endStream: false, signal });
|
|
47828
47870
|
stream[kHTTP2Stream] = true;
|
|
47871
|
+
++session[kOpenStreams];
|
|
47829
47872
|
stream.once("response", (headers2, _flags) => {
|
|
47830
47873
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2;
|
|
47831
|
-
|
|
47832
|
-
|
|
47874
|
+
try {
|
|
47875
|
+
request2.onUpgrade(statusCode, parseH2Headers(realHeaders), stream);
|
|
47876
|
+
} catch (err2) {
|
|
47877
|
+
abort(err2);
|
|
47878
|
+
return;
|
|
47879
|
+
}
|
|
47833
47880
|
completeRequest(client, request2);
|
|
47834
47881
|
});
|
|
47835
47882
|
stream.on("error", () => {
|
|
@@ -47846,10 +47893,15 @@ var require_client_h2 = __commonJS({
|
|
|
47846
47893
|
}
|
|
47847
47894
|
stream = session.request(headers, { endStream: false, signal });
|
|
47848
47895
|
stream[kHTTP2Stream] = true;
|
|
47896
|
+
++session[kOpenStreams];
|
|
47849
47897
|
stream.on("response", (headers2) => {
|
|
47850
47898
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2;
|
|
47851
|
-
|
|
47852
|
-
|
|
47899
|
+
try {
|
|
47900
|
+
request2.onUpgrade(statusCode, parseH2Headers(realHeaders), stream);
|
|
47901
|
+
} catch (err2) {
|
|
47902
|
+
abort(err2);
|
|
47903
|
+
return;
|
|
47904
|
+
}
|
|
47853
47905
|
completeRequest(client, request2);
|
|
47854
47906
|
});
|
|
47855
47907
|
stream.on("error", abort);
|
|
@@ -48283,7 +48335,8 @@ var require_client = __commonJS({
|
|
|
48283
48335
|
initialWindowSize,
|
|
48284
48336
|
connectionWindowSize,
|
|
48285
48337
|
pingInterval,
|
|
48286
|
-
webSocket
|
|
48338
|
+
webSocket,
|
|
48339
|
+
eventSource
|
|
48287
48340
|
} = {}) {
|
|
48288
48341
|
if (keepAlive !== void 0) {
|
|
48289
48342
|
throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
|
|
@@ -48361,7 +48414,7 @@ var require_client = __commonJS({
|
|
|
48361
48414
|
if (pingInterval != null && (typeof pingInterval !== "number" || !Number.isInteger(pingInterval) || pingInterval < 0)) {
|
|
48362
48415
|
throw new InvalidArgumentError("pingInterval must be a positive integer, greater or equal to 0");
|
|
48363
48416
|
}
|
|
48364
|
-
super({ webSocket });
|
|
48417
|
+
super({ webSocket, eventSource });
|
|
48365
48418
|
if (typeof connect2 !== "function") {
|
|
48366
48419
|
connect2 = buildConnector({
|
|
48367
48420
|
...tls,
|
|
@@ -49342,7 +49395,7 @@ var require_agent = __commonJS({
|
|
|
49342
49395
|
return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
|
|
49343
49396
|
}
|
|
49344
49397
|
var Agent = class extends DispatcherBase {
|
|
49345
|
-
constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
|
|
49398
|
+
constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
|
|
49346
49399
|
if (typeof factory !== "function") {
|
|
49347
49400
|
throw new InvalidArgumentError("factory must be a function.");
|
|
49348
49401
|
}
|
|
@@ -49356,7 +49409,10 @@ var require_agent = __commonJS({
|
|
|
49356
49409
|
if (connect && typeof connect !== "function") {
|
|
49357
49410
|
connect = { ...connect };
|
|
49358
49411
|
}
|
|
49359
|
-
|
|
49412
|
+
if (tls && typeof tls !== "function") {
|
|
49413
|
+
tls = { ...tls };
|
|
49414
|
+
}
|
|
49415
|
+
this[kOptions] = { ...util.deepClone(options), maxOrigins, connect, tls };
|
|
49360
49416
|
this[kFactory] = factory;
|
|
49361
49417
|
this[kClients] = /* @__PURE__ */ new Map();
|
|
49362
49418
|
this[kOrigins] = /* @__PURE__ */ new Set();
|
|
@@ -50565,6 +50621,55 @@ var require_retry_handler = __commonJS({
|
|
|
50565
50621
|
});
|
|
50566
50622
|
}
|
|
50567
50623
|
}
|
|
50624
|
+
var RetryController = class {
|
|
50625
|
+
#paused = false;
|
|
50626
|
+
#target = null;
|
|
50627
|
+
set target(target) {
|
|
50628
|
+
this.#target = target;
|
|
50629
|
+
if (this.#paused) {
|
|
50630
|
+
target?.pause();
|
|
50631
|
+
}
|
|
50632
|
+
}
|
|
50633
|
+
get target() {
|
|
50634
|
+
return this.#target;
|
|
50635
|
+
}
|
|
50636
|
+
pause() {
|
|
50637
|
+
this.#paused = true;
|
|
50638
|
+
this.#target?.pause();
|
|
50639
|
+
}
|
|
50640
|
+
resume() {
|
|
50641
|
+
this.#paused = false;
|
|
50642
|
+
this.#target?.resume();
|
|
50643
|
+
}
|
|
50644
|
+
abort(reason) {
|
|
50645
|
+
this.#target?.abort(reason);
|
|
50646
|
+
}
|
|
50647
|
+
get paused() {
|
|
50648
|
+
return this.#paused || (this.#target?.paused ?? false);
|
|
50649
|
+
}
|
|
50650
|
+
get aborted() {
|
|
50651
|
+
return this.#target?.aborted ?? false;
|
|
50652
|
+
}
|
|
50653
|
+
get reason() {
|
|
50654
|
+
return this.#target?.reason ?? null;
|
|
50655
|
+
}
|
|
50656
|
+
get rawHeaders() {
|
|
50657
|
+
return this.#target?.rawHeaders ?? null;
|
|
50658
|
+
}
|
|
50659
|
+
set rawHeaders(value) {
|
|
50660
|
+
if (this.#target) {
|
|
50661
|
+
this.#target.rawHeaders = value;
|
|
50662
|
+
}
|
|
50663
|
+
}
|
|
50664
|
+
get rawTrailers() {
|
|
50665
|
+
return this.#target?.rawTrailers ?? null;
|
|
50666
|
+
}
|
|
50667
|
+
set rawTrailers(value) {
|
|
50668
|
+
if (this.#target) {
|
|
50669
|
+
this.#target.rawTrailers = value;
|
|
50670
|
+
}
|
|
50671
|
+
}
|
|
50672
|
+
};
|
|
50568
50673
|
var RetryHandler = class _RetryHandler {
|
|
50569
50674
|
constructor(opts, { dispatch, handler }) {
|
|
50570
50675
|
const { retryOptions, ...dispatchOpts } = opts;
|
|
@@ -50619,16 +50724,17 @@ var require_retry_handler = __commonJS({
|
|
|
50619
50724
|
this.start = 0;
|
|
50620
50725
|
this.end = null;
|
|
50621
50726
|
this.etag = null;
|
|
50727
|
+
this.controllerProxy = new RetryController();
|
|
50622
50728
|
}
|
|
50623
50729
|
onResponseStartWithRetry(controller, statusCode, headers, statusMessage, err2) {
|
|
50624
50730
|
if (this.retryOpts.throwOnError) {
|
|
50625
50731
|
if (this.retryOpts.statusCodes.includes(statusCode) === false) {
|
|
50626
50732
|
if (this.headersSent) {
|
|
50627
|
-
this.handler.onResponseError?.(
|
|
50733
|
+
this.handler.onResponseError?.(this.controllerProxy, err2);
|
|
50628
50734
|
} else {
|
|
50629
50735
|
this.headersSent = true;
|
|
50630
50736
|
this.checkpointResponseEnd(headers);
|
|
50631
|
-
this.handler.onResponseStart?.(
|
|
50737
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
50632
50738
|
}
|
|
50633
50739
|
} else {
|
|
50634
50740
|
this.error = err2;
|
|
@@ -50638,17 +50744,17 @@ var require_retry_handler = __commonJS({
|
|
|
50638
50744
|
if (isDisturbed(this.opts.body)) {
|
|
50639
50745
|
this.headersSent = true;
|
|
50640
50746
|
this.checkpointResponseEnd(headers);
|
|
50641
|
-
this.handler.onResponseStart?.(
|
|
50747
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
50642
50748
|
return;
|
|
50643
50749
|
}
|
|
50644
50750
|
function shouldRetry(passedErr) {
|
|
50645
50751
|
if (passedErr) {
|
|
50646
50752
|
if (this.headersSent) {
|
|
50647
|
-
this.handler.onResponseError?.(
|
|
50753
|
+
this.handler.onResponseError?.(this.controllerProxy, passedErr);
|
|
50648
50754
|
} else {
|
|
50649
50755
|
this.headersSent = true;
|
|
50650
50756
|
this.checkpointResponseEnd(headers);
|
|
50651
|
-
this.handler.onResponseStart?.(
|
|
50757
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
50652
50758
|
}
|
|
50653
50759
|
controller.resume();
|
|
50654
50760
|
return;
|
|
@@ -50678,12 +50784,13 @@ var require_retry_handler = __commonJS({
|
|
|
50678
50784
|
}
|
|
50679
50785
|
}
|
|
50680
50786
|
onRequestStart(controller, context) {
|
|
50787
|
+
this.controllerProxy.target = controller;
|
|
50681
50788
|
if (!this.headersSent) {
|
|
50682
|
-
this.handler.onRequestStart?.(
|
|
50789
|
+
this.handler.onRequestStart?.(this.controllerProxy, context);
|
|
50683
50790
|
}
|
|
50684
50791
|
}
|
|
50685
|
-
onRequestUpgrade(
|
|
50686
|
-
this.handler.onRequestUpgrade?.(
|
|
50792
|
+
onRequestUpgrade(_controller, statusCode, headers, socket) {
|
|
50793
|
+
this.handler.onRequestUpgrade?.(this.controllerProxy, statusCode, headers, socket);
|
|
50687
50794
|
}
|
|
50688
50795
|
static [kRetryHandlerDefaultRetry](err2, { state, opts }, cb) {
|
|
50689
50796
|
const { statusCode, code: code2, headers } = err2;
|
|
@@ -50771,7 +50878,7 @@ var require_retry_handler = __commonJS({
|
|
|
50771
50878
|
if (range == null) {
|
|
50772
50879
|
this.headersSent = true;
|
|
50773
50880
|
this.handler.onResponseStart?.(
|
|
50774
|
-
|
|
50881
|
+
this.controllerProxy,
|
|
50775
50882
|
statusCode,
|
|
50776
50883
|
headers,
|
|
50777
50884
|
statusMessage
|
|
@@ -50804,7 +50911,7 @@ var require_retry_handler = __commonJS({
|
|
|
50804
50911
|
}
|
|
50805
50912
|
this.headersSent = true;
|
|
50806
50913
|
this.handler.onResponseStart?.(
|
|
50807
|
-
|
|
50914
|
+
this.controllerProxy,
|
|
50808
50915
|
statusCode,
|
|
50809
50916
|
headers,
|
|
50810
50917
|
statusMessage
|
|
@@ -50816,24 +50923,24 @@ var require_retry_handler = __commonJS({
|
|
|
50816
50923
|
});
|
|
50817
50924
|
}
|
|
50818
50925
|
}
|
|
50819
|
-
onResponseData(
|
|
50926
|
+
onResponseData(_controller, chunk2) {
|
|
50820
50927
|
if (this.error) {
|
|
50821
50928
|
return;
|
|
50822
50929
|
}
|
|
50823
50930
|
this.start += chunk2.length;
|
|
50824
|
-
this.handler.onResponseData?.(
|
|
50931
|
+
this.handler.onResponseData?.(this.controllerProxy, chunk2);
|
|
50825
50932
|
}
|
|
50826
|
-
onResponseEnd(
|
|
50933
|
+
onResponseEnd(_controller, trailers) {
|
|
50827
50934
|
if (this.error && this.retryOpts.throwOnError) {
|
|
50828
50935
|
throw this.error;
|
|
50829
50936
|
}
|
|
50830
50937
|
if (!this.error) {
|
|
50831
50938
|
this.retryCount = 0;
|
|
50832
|
-
return this.handler.onResponseEnd?.(
|
|
50939
|
+
return this.handler.onResponseEnd?.(this.controllerProxy, trailers);
|
|
50833
50940
|
}
|
|
50834
|
-
this.retry(
|
|
50941
|
+
this.retry();
|
|
50835
50942
|
}
|
|
50836
|
-
retry(
|
|
50943
|
+
retry() {
|
|
50837
50944
|
if (this.start !== 0) {
|
|
50838
50945
|
const headers = { range: `bytes=${this.start}-${this.end ?? ""}` };
|
|
50839
50946
|
if (this.etag != null) {
|
|
@@ -50851,20 +50958,20 @@ var require_retry_handler = __commonJS({
|
|
|
50851
50958
|
this.retryCountCheckpoint = this.retryCount;
|
|
50852
50959
|
this.dispatch(this.opts, this);
|
|
50853
50960
|
} catch (err2) {
|
|
50854
|
-
this.handler.onResponseError?.(
|
|
50961
|
+
this.handler.onResponseError?.(this.controllerProxy, err2);
|
|
50855
50962
|
}
|
|
50856
50963
|
}
|
|
50857
50964
|
onResponseError(controller, err2) {
|
|
50858
50965
|
if (controller?.aborted || isDisturbed(this.opts.body) || this.headersSent && !this.resume) {
|
|
50859
|
-
this.handler.onResponseError?.(
|
|
50966
|
+
this.handler.onResponseError?.(this.controllerProxy, err2);
|
|
50860
50967
|
return;
|
|
50861
50968
|
}
|
|
50862
50969
|
function shouldRetry(returnedErr) {
|
|
50863
50970
|
if (!returnedErr) {
|
|
50864
|
-
this.retry(
|
|
50971
|
+
this.retry();
|
|
50865
50972
|
return;
|
|
50866
50973
|
}
|
|
50867
|
-
this.handler?.onResponseError?.(
|
|
50974
|
+
this.handler?.onResponseError?.(this.controllerProxy, returnedErr);
|
|
50868
50975
|
}
|
|
50869
50976
|
if (this.retryCount - this.retryCountCheckpoint > 0) {
|
|
50870
50977
|
this.retryCount = this.retryCountCheckpoint + (this.retryCount - this.retryCountCheckpoint);
|
|
@@ -54169,7 +54276,7 @@ var require_redirect_handler = __commonJS({
|
|
|
54169
54276
|
"node_modules/undici/lib/handler/redirect-handler.js"(exports2, module2) {
|
|
54170
54277
|
"use strict";
|
|
54171
54278
|
var util = require_util();
|
|
54172
|
-
var { kBodyUsed } = require_symbols();
|
|
54279
|
+
var { kBodyUsed, kRedirectCacheControl } = require_symbols();
|
|
54173
54280
|
var assert = require("assert");
|
|
54174
54281
|
var { InvalidArgumentError } = require_errors();
|
|
54175
54282
|
var EE = require("events");
|
|
@@ -54207,6 +54314,10 @@ var require_redirect_handler = __commonJS({
|
|
|
54207
54314
|
this.maxRedirections = maxRedirections;
|
|
54208
54315
|
this.handler = handler;
|
|
54209
54316
|
this.history = [];
|
|
54317
|
+
Object.defineProperty(this.history, kRedirectCacheControl, {
|
|
54318
|
+
value: [],
|
|
54319
|
+
enumerable: false
|
|
54320
|
+
});
|
|
54210
54321
|
if (util.isStream(this.opts.body)) {
|
|
54211
54322
|
if (util.bodyLength(this.opts.body) === 0) {
|
|
54212
54323
|
this.opts.body.on("data", function() {
|
|
@@ -54257,6 +54368,7 @@ var require_redirect_handler = __commonJS({
|
|
|
54257
54368
|
this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
|
|
54258
54369
|
return;
|
|
54259
54370
|
}
|
|
54371
|
+
this.history[kRedirectCacheControl].push(headers["cache-control"]);
|
|
54260
54372
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
54261
54373
|
const path99 = search ? `${pathname}${search}` : pathname;
|
|
54262
54374
|
const redirectUrlString = `${origin}${path99}`;
|
|
@@ -55958,6 +56070,7 @@ var require_cache_handler = __commonJS({
|
|
|
55958
56070
|
"node_modules/undici/lib/handler/cache-handler.js"(exports2, module2) {
|
|
55959
56071
|
"use strict";
|
|
55960
56072
|
var util = require_util();
|
|
56073
|
+
var { kRedirectCacheControl } = require_symbols();
|
|
55961
56074
|
var {
|
|
55962
56075
|
parseCacheControlHeader,
|
|
55963
56076
|
hasInvalidCacheControlDirective,
|
|
@@ -55969,6 +56082,13 @@ var require_cache_handler = __commonJS({
|
|
|
55969
56082
|
var { parseHttpDate } = require_date();
|
|
55970
56083
|
function noop() {
|
|
55971
56084
|
}
|
|
56085
|
+
function sameOrigin(a, b) {
|
|
56086
|
+
try {
|
|
56087
|
+
return new URL(String(a)).origin === new URL(String(b)).origin;
|
|
56088
|
+
} catch {
|
|
56089
|
+
return String(a) === String(b);
|
|
56090
|
+
}
|
|
56091
|
+
}
|
|
55972
56092
|
var HEURISTICALLY_CACHEABLE_STATUS_CODES = [
|
|
55973
56093
|
200,
|
|
55974
56094
|
203,
|
|
@@ -56084,6 +56204,13 @@ var require_cache_handler = __commonJS({
|
|
|
56084
56204
|
* @type {import('node:stream').Writable | undefined}
|
|
56085
56205
|
*/
|
|
56086
56206
|
#writeStream;
|
|
56207
|
+
/**
|
|
56208
|
+
* The URLs visited while following redirects, shared by reference from the
|
|
56209
|
+
* redirect handler through the request context. Carries the suppressed hops'
|
|
56210
|
+
* cache-control under {@link kRedirectCacheControl}.
|
|
56211
|
+
* @type {URL[] | undefined}
|
|
56212
|
+
*/
|
|
56213
|
+
#history;
|
|
56087
56214
|
/**
|
|
56088
56215
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
|
|
56089
56216
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
@@ -56099,6 +56226,7 @@ var require_cache_handler = __commonJS({
|
|
|
56099
56226
|
onRequestStart(controller, context) {
|
|
56100
56227
|
this.#writeStream?.destroy();
|
|
56101
56228
|
this.#writeStream = void 0;
|
|
56229
|
+
this.#history = context?.history;
|
|
56102
56230
|
this.#handler.onRequestStart?.(controller, context);
|
|
56103
56231
|
}
|
|
56104
56232
|
onRequestUpgrade(controller, statusCode, headers, socket) {
|
|
@@ -56122,6 +56250,21 @@ var require_cache_handler = __commonJS({
|
|
|
56122
56250
|
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
|
|
56123
56251
|
return downstreamOnHeaders();
|
|
56124
56252
|
}
|
|
56253
|
+
if (this.#history && this.#history.length > 0) {
|
|
56254
|
+
const finalUrl = this.#history[this.#history.length - 1];
|
|
56255
|
+
if (!sameOrigin(finalUrl.origin, this.#cacheKey.origin)) {
|
|
56256
|
+
return downstreamOnHeaders();
|
|
56257
|
+
}
|
|
56258
|
+
}
|
|
56259
|
+
const redirectCacheControl = this.#history?.[kRedirectCacheControl];
|
|
56260
|
+
if (redirectCacheControl) {
|
|
56261
|
+
for (const hopCacheControl of redirectCacheControl) {
|
|
56262
|
+
const hopDirectives = hopCacheControl ? parseCacheControlHeader(hopCacheControl) : {};
|
|
56263
|
+
if (hopDirectives["no-store"] === true || this.#cacheType === "shared" && hopDirectives.private === true) {
|
|
56264
|
+
return downstreamOnHeaders();
|
|
56265
|
+
}
|
|
56266
|
+
}
|
|
56267
|
+
}
|
|
56125
56268
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
56126
56269
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
56127
56270
|
if (revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives)) {
|
|
@@ -57198,6 +57341,61 @@ var require_decompress = __commonJS({
|
|
|
57198
57341
|
var { InvalidArgumentError, ResponseExceededMaxSizeError } = require_errors();
|
|
57199
57342
|
var DecoratorHandler = require_decorator_handler();
|
|
57200
57343
|
var { runtimeFeatures } = require_runtime_features();
|
|
57344
|
+
var DecompressController = class {
|
|
57345
|
+
#onPause;
|
|
57346
|
+
#onResume;
|
|
57347
|
+
#onAbort;
|
|
57348
|
+
#paused = false;
|
|
57349
|
+
constructor(onPause, onResume, onAbort) {
|
|
57350
|
+
this.#onPause = onPause;
|
|
57351
|
+
this.#onResume = onResume;
|
|
57352
|
+
this.#onAbort = onAbort;
|
|
57353
|
+
this.target = null;
|
|
57354
|
+
}
|
|
57355
|
+
pause() {
|
|
57356
|
+
if (this.#paused) {
|
|
57357
|
+
return;
|
|
57358
|
+
}
|
|
57359
|
+
this.#paused = true;
|
|
57360
|
+
this.#onPause();
|
|
57361
|
+
}
|
|
57362
|
+
resume() {
|
|
57363
|
+
if (!this.#paused) {
|
|
57364
|
+
return;
|
|
57365
|
+
}
|
|
57366
|
+
this.#paused = false;
|
|
57367
|
+
this.#onResume();
|
|
57368
|
+
}
|
|
57369
|
+
abort(reason) {
|
|
57370
|
+
this.target?.abort(reason);
|
|
57371
|
+
this.#onAbort(reason);
|
|
57372
|
+
}
|
|
57373
|
+
get paused() {
|
|
57374
|
+
return this.#paused;
|
|
57375
|
+
}
|
|
57376
|
+
get aborted() {
|
|
57377
|
+
return this.target?.aborted ?? false;
|
|
57378
|
+
}
|
|
57379
|
+
get reason() {
|
|
57380
|
+
return this.target?.reason ?? null;
|
|
57381
|
+
}
|
|
57382
|
+
get rawHeaders() {
|
|
57383
|
+
return this.target?.rawHeaders ?? null;
|
|
57384
|
+
}
|
|
57385
|
+
set rawHeaders(value) {
|
|
57386
|
+
if (this.target) {
|
|
57387
|
+
this.target.rawHeaders = value;
|
|
57388
|
+
}
|
|
57389
|
+
}
|
|
57390
|
+
get rawTrailers() {
|
|
57391
|
+
return this.target?.rawTrailers ?? null;
|
|
57392
|
+
}
|
|
57393
|
+
set rawTrailers(value) {
|
|
57394
|
+
if (this.target) {
|
|
57395
|
+
this.target.rawTrailers = value;
|
|
57396
|
+
}
|
|
57397
|
+
}
|
|
57398
|
+
};
|
|
57201
57399
|
var supportedEncodings = {
|
|
57202
57400
|
gzip: createGunzip,
|
|
57203
57401
|
"x-gzip": createGunzip,
|
|
@@ -57211,7 +57409,7 @@ var require_decompress = __commonJS({
|
|
|
57211
57409
|
/** @type {const} */
|
|
57212
57410
|
[204, 304]
|
|
57213
57411
|
);
|
|
57214
|
-
var defaultMaxSize =
|
|
57412
|
+
var defaultMaxSize = 0;
|
|
57215
57413
|
function createMaxSizeLimiter(maxSize) {
|
|
57216
57414
|
let size = 0;
|
|
57217
57415
|
return new TransformStream2({
|
|
@@ -57249,14 +57447,124 @@ var require_decompress = __commonJS({
|
|
|
57249
57447
|
#terminated = false;
|
|
57250
57448
|
/** @type {boolean} */
|
|
57251
57449
|
#inputEnded = false;
|
|
57450
|
+
/** @type {boolean} */
|
|
57451
|
+
#inputBackpressured = false;
|
|
57452
|
+
/** @type {boolean} */
|
|
57453
|
+
#upstreamPaused = false;
|
|
57454
|
+
/** @type {boolean} */
|
|
57455
|
+
#draining = false;
|
|
57456
|
+
/** @type {boolean} */
|
|
57457
|
+
#drainRequested = false;
|
|
57458
|
+
/** @type {boolean} */
|
|
57459
|
+
#completionPending = false;
|
|
57460
|
+
/** @type {DecompressorStream | undefined} */
|
|
57461
|
+
#finalDecompressor;
|
|
57462
|
+
/** @type {DecompressController} */
|
|
57463
|
+
#controller;
|
|
57252
57464
|
constructor(handler, { skipStatusCodes = defaultSkipStatusCodes, skipErrorResponses = true, maxSize = defaultMaxSize } = {}) {
|
|
57253
|
-
if (!Number.isSafeInteger(maxSize) || maxSize <
|
|
57254
|
-
throw new InvalidArgumentError("maxSize must be a
|
|
57465
|
+
if (!Number.isSafeInteger(maxSize) || maxSize < 0) {
|
|
57466
|
+
throw new InvalidArgumentError("maxSize must be a non-negative integer");
|
|
57255
57467
|
}
|
|
57256
57468
|
super(handler);
|
|
57257
57469
|
this.#skipStatusCodes = skipStatusCodes;
|
|
57258
57470
|
this.#skipErrorResponses = skipErrorResponses;
|
|
57259
57471
|
this.#maxSize = maxSize;
|
|
57472
|
+
this.#controller = new DecompressController(
|
|
57473
|
+
() => this.#onDownstreamPause(),
|
|
57474
|
+
() => this.#onDownstreamResume(),
|
|
57475
|
+
(reason) => {
|
|
57476
|
+
if (this.#inputEnded && !this.#terminated) {
|
|
57477
|
+
this.onResponseError(this.#controller, reason);
|
|
57478
|
+
}
|
|
57479
|
+
}
|
|
57480
|
+
);
|
|
57481
|
+
}
|
|
57482
|
+
#onDownstreamPause() {
|
|
57483
|
+
this.#pauseUpstream();
|
|
57484
|
+
}
|
|
57485
|
+
#onDownstreamResume() {
|
|
57486
|
+
const drainWasDeferred = this.#draining;
|
|
57487
|
+
this.#drainOutput();
|
|
57488
|
+
if (!drainWasDeferred) {
|
|
57489
|
+
this.#resumeUpstreamIfNeeded();
|
|
57490
|
+
this.#finishIfReady();
|
|
57491
|
+
}
|
|
57492
|
+
}
|
|
57493
|
+
#pauseUpstream() {
|
|
57494
|
+
if (!this.#upstreamPaused && !this.#terminated) {
|
|
57495
|
+
this.#upstreamPaused = true;
|
|
57496
|
+
this.#controller.target?.pause();
|
|
57497
|
+
}
|
|
57498
|
+
}
|
|
57499
|
+
#resumeUpstreamIfNeeded() {
|
|
57500
|
+
if (this.#upstreamPaused && !this.#controller.paused && !this.#inputBackpressured) {
|
|
57501
|
+
this.#upstreamPaused = false;
|
|
57502
|
+
if (!this.#inputEnded) {
|
|
57503
|
+
this.#controller.target?.resume();
|
|
57504
|
+
}
|
|
57505
|
+
}
|
|
57506
|
+
}
|
|
57507
|
+
#drainOutput() {
|
|
57508
|
+
if (this.#terminated || this.#controller.paused || !this.#finalDecompressor) {
|
|
57509
|
+
return;
|
|
57510
|
+
}
|
|
57511
|
+
if (this.#draining) {
|
|
57512
|
+
this.#drainRequested = true;
|
|
57513
|
+
return;
|
|
57514
|
+
}
|
|
57515
|
+
this.#draining = true;
|
|
57516
|
+
try {
|
|
57517
|
+
do {
|
|
57518
|
+
this.#drainRequested = false;
|
|
57519
|
+
let chunk2;
|
|
57520
|
+
while (!this.#terminated && !this.#controller.paused && (chunk2 = this.#finalDecompressor.read()) !== null) {
|
|
57521
|
+
if (this.#maxSize > 0) {
|
|
57522
|
+
const decompressedSize = this.#decompressedSize + chunk2.length;
|
|
57523
|
+
if (decompressedSize > this.#maxSize) {
|
|
57524
|
+
this.#fail(new ResponseExceededMaxSizeError(
|
|
57525
|
+
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
57526
|
+
));
|
|
57527
|
+
return;
|
|
57528
|
+
}
|
|
57529
|
+
this.#decompressedSize = decompressedSize;
|
|
57530
|
+
}
|
|
57531
|
+
try {
|
|
57532
|
+
const result = super.onResponseData(this.#controller, chunk2);
|
|
57533
|
+
if (result === false && !this.#controller.paused) {
|
|
57534
|
+
this.#controller.pause();
|
|
57535
|
+
}
|
|
57536
|
+
} catch (err2) {
|
|
57537
|
+
this.#fail(err2);
|
|
57538
|
+
return;
|
|
57539
|
+
}
|
|
57540
|
+
}
|
|
57541
|
+
} while (this.#drainRequested && !this.#terminated && !this.#controller.paused);
|
|
57542
|
+
} finally {
|
|
57543
|
+
this.#draining = false;
|
|
57544
|
+
}
|
|
57545
|
+
this.#resumeUpstreamIfNeeded();
|
|
57546
|
+
this.#finishIfReady();
|
|
57547
|
+
}
|
|
57548
|
+
#finishIfReady() {
|
|
57549
|
+
if (this.#terminated || !this.#completionPending || this.#controller.paused || this.#draining) {
|
|
57550
|
+
return;
|
|
57551
|
+
}
|
|
57552
|
+
this.#cleanupDecompressors();
|
|
57553
|
+
try {
|
|
57554
|
+
super.onResponseEnd(this.#controller, this.#trailers);
|
|
57555
|
+
} catch (err2) {
|
|
57556
|
+
this.#fail(err2);
|
|
57557
|
+
return;
|
|
57558
|
+
}
|
|
57559
|
+
this.#terminated = true;
|
|
57560
|
+
}
|
|
57561
|
+
#onDecompressionEnd() {
|
|
57562
|
+
if (this.#terminated) {
|
|
57563
|
+
return;
|
|
57564
|
+
}
|
|
57565
|
+
this.#completionPending = true;
|
|
57566
|
+
this.#drainOutput();
|
|
57567
|
+
this.#finishIfReady();
|
|
57260
57568
|
}
|
|
57261
57569
|
/**
|
|
57262
57570
|
* Determines if decompression should be skipped based on encoding and status code
|
|
@@ -57299,7 +57607,7 @@ var require_decompress = __commonJS({
|
|
|
57299
57607
|
const streams = [];
|
|
57300
57608
|
for (let i = 0; i < decompressors.length; i++) {
|
|
57301
57609
|
streams.push(decompressors[i]);
|
|
57302
|
-
if (i < decompressors.length - 1) {
|
|
57610
|
+
if (i < decompressors.length - 1 && this.#maxSize > 0) {
|
|
57303
57611
|
streams.push(createMaxSizeLimiter(this.#maxSize));
|
|
57304
57612
|
}
|
|
57305
57613
|
}
|
|
@@ -57307,87 +57615,67 @@ var require_decompress = __commonJS({
|
|
|
57307
57615
|
}
|
|
57308
57616
|
/**
|
|
57309
57617
|
* Stops decompression and reports an error.
|
|
57310
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
57311
57618
|
* @param {Error} error - The decompression error
|
|
57312
57619
|
* @returns {void}
|
|
57313
57620
|
*/
|
|
57314
|
-
#fail(
|
|
57621
|
+
#fail(error) {
|
|
57315
57622
|
if (this.#terminated) {
|
|
57316
57623
|
return;
|
|
57317
57624
|
}
|
|
57318
57625
|
if (this.#inputEnded) {
|
|
57319
|
-
this.onResponseError(controller, error);
|
|
57626
|
+
this.onResponseError(this.#controller, error);
|
|
57320
57627
|
} else {
|
|
57321
|
-
controller.abort(error);
|
|
57628
|
+
this.#controller.abort(error);
|
|
57322
57629
|
}
|
|
57323
57630
|
}
|
|
57324
57631
|
/**
|
|
57325
|
-
* Sets up event handlers for
|
|
57632
|
+
* Sets up event handlers for the final decompressor stream.
|
|
57326
57633
|
* @param {DecompressorStream} decompressor - The decompressor stream
|
|
57327
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
57328
57634
|
* @returns {void}
|
|
57329
57635
|
*/
|
|
57330
|
-
#setupDecompressorEvents(decompressor
|
|
57331
|
-
|
|
57332
|
-
|
|
57333
|
-
|
|
57334
|
-
}
|
|
57335
|
-
let chunk2;
|
|
57336
|
-
while ((chunk2 = decompressor.read()) !== null) {
|
|
57337
|
-
const decompressedSize = this.#decompressedSize + chunk2.length;
|
|
57338
|
-
if (decompressedSize > this.#maxSize) {
|
|
57339
|
-
this.#fail(controller, new ResponseExceededMaxSizeError(
|
|
57340
|
-
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
57341
|
-
));
|
|
57342
|
-
return;
|
|
57343
|
-
}
|
|
57344
|
-
this.#decompressedSize = decompressedSize;
|
|
57345
|
-
const result = super.onResponseData(controller, chunk2);
|
|
57346
|
-
if (result === false) {
|
|
57347
|
-
break;
|
|
57348
|
-
}
|
|
57349
|
-
}
|
|
57350
|
-
});
|
|
57351
|
-
decompressor.on("error", (error) => {
|
|
57352
|
-
this.#fail(controller, error);
|
|
57353
|
-
});
|
|
57636
|
+
#setupDecompressorEvents(decompressor) {
|
|
57637
|
+
this.#finalDecompressor = decompressor;
|
|
57638
|
+
decompressor.on("readable", () => this.#drainOutput());
|
|
57639
|
+
decompressor.on("error", (error) => this.#fail(error));
|
|
57354
57640
|
}
|
|
57355
57641
|
/**
|
|
57356
57642
|
* Sets up event handling for a single decompressor
|
|
57357
|
-
* @param {Controller} controller - The controller to handle events
|
|
57358
57643
|
* @returns {void}
|
|
57359
57644
|
*/
|
|
57360
|
-
#setupSingleDecompressor(
|
|
57645
|
+
#setupSingleDecompressor() {
|
|
57361
57646
|
const decompressor = this.#decompressors[0];
|
|
57362
|
-
this.#setupDecompressorEvents(decompressor
|
|
57363
|
-
decompressor.on("end", () =>
|
|
57364
|
-
if (this.#terminated) {
|
|
57365
|
-
return;
|
|
57366
|
-
}
|
|
57367
|
-
this.#terminated = true;
|
|
57368
|
-
this.#cleanupDecompressors();
|
|
57369
|
-
super.onResponseEnd(controller, this.#trailers);
|
|
57370
|
-
});
|
|
57647
|
+
this.#setupDecompressorEvents(decompressor);
|
|
57648
|
+
decompressor.on("end", () => this.#onDecompressionEnd());
|
|
57371
57649
|
}
|
|
57372
57650
|
/**
|
|
57373
57651
|
* Sets up event handling for multiple chained decompressors using pipeline
|
|
57374
|
-
* @param {Controller} controller - The controller to handle events
|
|
57375
57652
|
* @returns {void}
|
|
57376
57653
|
*/
|
|
57377
|
-
#setupMultipleDecompressors(
|
|
57654
|
+
#setupMultipleDecompressors() {
|
|
57378
57655
|
const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
|
|
57379
|
-
this.#setupDecompressorEvents(lastDecompressor
|
|
57656
|
+
this.#setupDecompressorEvents(lastDecompressor);
|
|
57380
57657
|
pipeline2(this.#decompressors, (err2) => {
|
|
57381
57658
|
if (this.#terminated) {
|
|
57382
57659
|
return;
|
|
57383
57660
|
}
|
|
57384
57661
|
if (err2) {
|
|
57385
|
-
this.#fail(
|
|
57662
|
+
this.#fail(err2);
|
|
57386
57663
|
return;
|
|
57387
57664
|
}
|
|
57388
|
-
this.#
|
|
57389
|
-
|
|
57390
|
-
|
|
57665
|
+
this.#onDecompressionEnd();
|
|
57666
|
+
});
|
|
57667
|
+
}
|
|
57668
|
+
#setupInputBackpressure() {
|
|
57669
|
+
const decompressor = this.#decompressors[0];
|
|
57670
|
+
decompressor.on("drain", () => {
|
|
57671
|
+
if (this.#terminated) {
|
|
57672
|
+
return;
|
|
57673
|
+
}
|
|
57674
|
+
this.#inputBackpressured = false;
|
|
57675
|
+
if (!this.#controller.paused) {
|
|
57676
|
+
this.#drainOutput();
|
|
57677
|
+
this.#resumeUpstreamIfNeeded();
|
|
57678
|
+
}
|
|
57391
57679
|
});
|
|
57392
57680
|
}
|
|
57393
57681
|
/**
|
|
@@ -57396,6 +57684,14 @@ var require_decompress = __commonJS({
|
|
|
57396
57684
|
*/
|
|
57397
57685
|
#cleanupDecompressors() {
|
|
57398
57686
|
this.#decompressors.length = 0;
|
|
57687
|
+
this.#finalDecompressor = void 0;
|
|
57688
|
+
}
|
|
57689
|
+
onRequestStart(controller, context) {
|
|
57690
|
+
this.#controller.target = controller;
|
|
57691
|
+
return super.onRequestStart(this.#controller, context);
|
|
57692
|
+
}
|
|
57693
|
+
onRequestUpgrade(controller, statusCode, headers, socket) {
|
|
57694
|
+
return super.onRequestUpgrade(this.#controller, statusCode, headers, socket);
|
|
57399
57695
|
}
|
|
57400
57696
|
/**
|
|
57401
57697
|
* @param {Controller} controller
|
|
@@ -57407,17 +57703,17 @@ var require_decompress = __commonJS({
|
|
|
57407
57703
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
57408
57704
|
const contentEncoding = headers["content-encoding"];
|
|
57409
57705
|
if (this.#shouldSkipDecompression(contentEncoding, statusCode)) {
|
|
57410
|
-
return super.onResponseStart(controller, statusCode, headers, statusMessage);
|
|
57706
|
+
return super.onResponseStart(this.#controller, statusCode, headers, statusMessage);
|
|
57411
57707
|
}
|
|
57412
57708
|
const decompressors = this.#createDecompressionChain(contentEncoding.toLowerCase());
|
|
57413
57709
|
if (decompressors.length === 0) {
|
|
57414
57710
|
this.#cleanupDecompressors();
|
|
57415
|
-
return super.onResponseStart(controller, statusCode, headers, statusMessage);
|
|
57711
|
+
return super.onResponseStart(this.#controller, statusCode, headers, statusMessage);
|
|
57416
57712
|
}
|
|
57417
57713
|
this.#decompressors = decompressors;
|
|
57418
57714
|
const { "content-encoding": _, "content-length": __, ...newHeaders } = headers;
|
|
57419
|
-
if (controller
|
|
57420
|
-
const rawHeaders = controller.rawHeaders;
|
|
57715
|
+
if (this.#controller.rawHeaders) {
|
|
57716
|
+
const rawHeaders = this.#controller.rawHeaders;
|
|
57421
57717
|
if (Array.isArray(rawHeaders)) {
|
|
57422
57718
|
const filteredHeaders = [];
|
|
57423
57719
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
@@ -57439,12 +57735,13 @@ var require_decompress = __commonJS({
|
|
|
57439
57735
|
}
|
|
57440
57736
|
}
|
|
57441
57737
|
}
|
|
57738
|
+
this.#setupInputBackpressure();
|
|
57442
57739
|
if (this.#decompressors.length === 1) {
|
|
57443
|
-
this.#setupSingleDecompressor(
|
|
57740
|
+
this.#setupSingleDecompressor();
|
|
57444
57741
|
} else {
|
|
57445
|
-
this.#setupMultipleDecompressors(
|
|
57742
|
+
this.#setupMultipleDecompressors();
|
|
57446
57743
|
}
|
|
57447
|
-
return super.onResponseStart(controller, statusCode, newHeaders, statusMessage);
|
|
57744
|
+
return super.onResponseStart(this.#controller, statusCode, newHeaders, statusMessage);
|
|
57448
57745
|
}
|
|
57449
57746
|
/**
|
|
57450
57747
|
* @param {Controller} controller
|
|
@@ -57453,10 +57750,13 @@ var require_decompress = __commonJS({
|
|
|
57453
57750
|
*/
|
|
57454
57751
|
onResponseData(controller, chunk2) {
|
|
57455
57752
|
if (this.#decompressors.length > 0) {
|
|
57456
|
-
this.#decompressors[0].write(chunk2)
|
|
57753
|
+
if (!this.#decompressors[0].write(chunk2)) {
|
|
57754
|
+
this.#inputBackpressured = true;
|
|
57755
|
+
this.#pauseUpstream();
|
|
57756
|
+
}
|
|
57457
57757
|
return;
|
|
57458
57758
|
}
|
|
57459
|
-
super.onResponseData(controller, chunk2);
|
|
57759
|
+
return super.onResponseData(this.#controller, chunk2);
|
|
57460
57760
|
}
|
|
57461
57761
|
/**
|
|
57462
57762
|
* @param {Controller} controller
|
|
@@ -57470,7 +57770,7 @@ var require_decompress = __commonJS({
|
|
|
57470
57770
|
this.#decompressors[0].end();
|
|
57471
57771
|
return;
|
|
57472
57772
|
}
|
|
57473
|
-
super.onResponseEnd(controller, trailers);
|
|
57773
|
+
return super.onResponseEnd(this.#controller, trailers);
|
|
57474
57774
|
}
|
|
57475
57775
|
/**
|
|
57476
57776
|
* @param {Controller} controller
|
|
@@ -57486,7 +57786,7 @@ var require_decompress = __commonJS({
|
|
|
57486
57786
|
decompressor.destroy();
|
|
57487
57787
|
}
|
|
57488
57788
|
this.#cleanupDecompressors();
|
|
57489
|
-
super.onResponseError(controller, err2);
|
|
57789
|
+
super.onResponseError(this.#controller, err2);
|
|
57490
57790
|
}
|
|
57491
57791
|
};
|
|
57492
57792
|
function createDecompressInterceptor(options = {}) {
|
|
@@ -57519,6 +57819,18 @@ var require_deduplication_handler = __commonJS({
|
|
|
57519
57819
|
* @type {DispatchHandler}
|
|
57520
57820
|
*/
|
|
57521
57821
|
#primaryHandler;
|
|
57822
|
+
/**
|
|
57823
|
+
* Whether the primary request has started (onRequestStart received). Until
|
|
57824
|
+
* then the request context is unknown and cannot be given to waiting handlers.
|
|
57825
|
+
* @type {boolean}
|
|
57826
|
+
*/
|
|
57827
|
+
#requestStarted = false;
|
|
57828
|
+
/**
|
|
57829
|
+
* The primary request context, replayed to waiting handlers so they observe
|
|
57830
|
+
* the same redirect history as the primary.
|
|
57831
|
+
* @type {any}
|
|
57832
|
+
*/
|
|
57833
|
+
#context = null;
|
|
57522
57834
|
/**
|
|
57523
57835
|
* @type {WaitingHandler[]}
|
|
57524
57836
|
*/
|
|
@@ -57587,18 +57899,22 @@ var require_deduplication_handler = __commonJS({
|
|
|
57587
57899
|
const waitingHandler = this.#createWaitingHandler(handler);
|
|
57588
57900
|
const waitingController = waitingHandler.controller;
|
|
57589
57901
|
try {
|
|
57590
|
-
|
|
57591
|
-
|
|
57592
|
-
|
|
57593
|
-
|
|
57594
|
-
|
|
57595
|
-
|
|
57596
|
-
|
|
57597
|
-
|
|
57598
|
-
|
|
57599
|
-
|
|
57600
|
-
|
|
57601
|
-
|
|
57902
|
+
if (this.#requestStarted) {
|
|
57903
|
+
handler.onRequestStart?.(waitingController, this.#context);
|
|
57904
|
+
if (waitingController.aborted) {
|
|
57905
|
+
waitingHandler.done = true;
|
|
57906
|
+
return true;
|
|
57907
|
+
}
|
|
57908
|
+
if (this.#responseStarted) {
|
|
57909
|
+
handler.onResponseStart?.(
|
|
57910
|
+
waitingController,
|
|
57911
|
+
this.#statusCode,
|
|
57912
|
+
this.#headers,
|
|
57913
|
+
this.#statusMessage
|
|
57914
|
+
);
|
|
57915
|
+
}
|
|
57916
|
+
} else {
|
|
57917
|
+
waitingHandler.pendingStart = true;
|
|
57602
57918
|
}
|
|
57603
57919
|
} catch {
|
|
57604
57920
|
waitingHandler.done = true;
|
|
@@ -57615,6 +57931,21 @@ var require_deduplication_handler = __commonJS({
|
|
|
57615
57931
|
*/
|
|
57616
57932
|
onRequestStart(controller, context) {
|
|
57617
57933
|
this.#controller = controller;
|
|
57934
|
+
if (!this.#requestStarted) {
|
|
57935
|
+
this.#requestStarted = true;
|
|
57936
|
+
this.#context = context;
|
|
57937
|
+
for (const waitingHandler of this.#waitingHandlers) {
|
|
57938
|
+
if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
|
|
57939
|
+
waitingHandler.pendingStart = false;
|
|
57940
|
+
try {
|
|
57941
|
+
waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context);
|
|
57942
|
+
} catch {
|
|
57943
|
+
waitingHandler.done = true;
|
|
57944
|
+
}
|
|
57945
|
+
}
|
|
57946
|
+
}
|
|
57947
|
+
this.#pruneDoneWaitingHandlers();
|
|
57948
|
+
}
|
|
57618
57949
|
this.#primaryHandler.onRequestStart?.(controller, context);
|
|
57619
57950
|
}
|
|
57620
57951
|
/**
|
|
@@ -57752,7 +58083,8 @@ var require_deduplication_handler = __commonJS({
|
|
|
57752
58083
|
bufferedChunks: [],
|
|
57753
58084
|
bufferedBytes: 0,
|
|
57754
58085
|
pendingTrailers: null,
|
|
57755
|
-
done: false
|
|
58086
|
+
done: false,
|
|
58087
|
+
pendingStart: false
|
|
57756
58088
|
};
|
|
57757
58089
|
const state = {
|
|
57758
58090
|
aborted: false,
|
|
@@ -59961,6 +60293,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
59961
60293
|
"use strict";
|
|
59962
60294
|
var assert = require("assert");
|
|
59963
60295
|
var { runtimeFeatures } = require_runtime_features();
|
|
60296
|
+
var { asciiLowercase } = require_infra();
|
|
59964
60297
|
var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
|
|
59965
60298
|
var crypto12;
|
|
59966
60299
|
if (runtimeFeatures.has("crypto")) {
|
|
@@ -59983,10 +60316,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
59983
60316
|
validSRIHashAlgorithmTokenSet
|
|
59984
60317
|
)
|
|
59985
60318
|
);
|
|
59986
|
-
var isValidSRIHashAlgorithm = (
|
|
59987
|
-
/** @type {IsValidSRIHashAlgorithm} */
|
|
59988
|
-
Map.prototype.has.bind(validSRIHashAlgorithmTokenSet)
|
|
59989
|
-
);
|
|
60319
|
+
var isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
|
|
59990
60320
|
var bytesMatch = runtimeFeatures.has("crypto") === false || validSRIHashAlgorithmTokenSet.size === 0 ? () => true : (bytes, metadataList) => {
|
|
59991
60321
|
const parsedMetadata = parseMetadata(metadataList);
|
|
59992
60322
|
if (parsedMetadata.length === 0) {
|
|
@@ -60047,7 +60377,8 @@ var require_subresource_integrity = __commonJS({
|
|
|
60047
60377
|
base64Value = algorithmAndValue[1];
|
|
60048
60378
|
}
|
|
60049
60379
|
const metadata2 = {
|
|
60050
|
-
|
|
60380
|
+
// Possible spec bug?
|
|
60381
|
+
alg: asciiLowercase(algorithm),
|
|
60051
60382
|
val: base64Value
|
|
60052
60383
|
};
|
|
60053
60384
|
result.push(metadata2);
|
|
@@ -61096,7 +61427,6 @@ var require_fetch = __commonJS({
|
|
|
61096
61427
|
}
|
|
61097
61428
|
}
|
|
61098
61429
|
const location = headersList.get("location", true);
|
|
61099
|
-
this.body = new Readable2({ read: resume });
|
|
61100
61430
|
const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status);
|
|
61101
61431
|
const decoders = [];
|
|
61102
61432
|
if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
|
|
@@ -61104,7 +61434,7 @@ var require_fetch = __commonJS({
|
|
|
61104
61434
|
const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : [];
|
|
61105
61435
|
const maxContentEncodings = 5;
|
|
61106
61436
|
if (codings.length > maxContentEncodings) {
|
|
61107
|
-
|
|
61437
|
+
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
|
|
61108
61438
|
return true;
|
|
61109
61439
|
}
|
|
61110
61440
|
for (let i = codings.length - 1; i >= 0; --i) {
|
|
@@ -61139,6 +61469,7 @@ var require_fetch = __commonJS({
|
|
|
61139
61469
|
}
|
|
61140
61470
|
}
|
|
61141
61471
|
}
|
|
61472
|
+
this.body = new Readable2({ read: resume });
|
|
61142
61473
|
const onError = this.onError.bind(this);
|
|
61143
61474
|
resolve2({
|
|
61144
61475
|
status,
|
|
@@ -62118,8 +62449,12 @@ var require_util4 = __commonJS({
|
|
|
62118
62449
|
validateCookiePath(cookie.path);
|
|
62119
62450
|
out.push(`Path=${cookie.path}`);
|
|
62120
62451
|
}
|
|
62121
|
-
if (cookie.expires
|
|
62122
|
-
|
|
62452
|
+
if (cookie.expires != null) {
|
|
62453
|
+
const expiresMs = cookie.expires instanceof Date ? cookie.expires.getTime() : cookie.expires;
|
|
62454
|
+
const maxTimeValue = 864e13;
|
|
62455
|
+
if (typeof expiresMs === "number" && Number.isFinite(expiresMs) && Math.abs(expiresMs) <= maxTimeValue) {
|
|
62456
|
+
out.push(`Expires=${toIMFDate(cookie.expires)}`);
|
|
62457
|
+
}
|
|
62123
62458
|
}
|
|
62124
62459
|
if (cookie.sameSite) {
|
|
62125
62460
|
out.push(`SameSite=${cookie.sameSite}`);
|
|
@@ -62194,88 +62529,89 @@ var require_parse = __commonJS({
|
|
|
62194
62529
|
};
|
|
62195
62530
|
}
|
|
62196
62531
|
function parseUnparsedAttributes(unparsedAttributes, cookieAttributeList = {}) {
|
|
62197
|
-
|
|
62198
|
-
|
|
62199
|
-
|
|
62200
|
-
|
|
62201
|
-
|
|
62202
|
-
|
|
62203
|
-
|
|
62204
|
-
|
|
62205
|
-
|
|
62206
|
-
|
|
62207
|
-
|
|
62208
|
-
|
|
62209
|
-
|
|
62210
|
-
|
|
62211
|
-
|
|
62212
|
-
|
|
62213
|
-
|
|
62214
|
-
|
|
62215
|
-
|
|
62216
|
-
|
|
62217
|
-
|
|
62218
|
-
|
|
62219
|
-
|
|
62220
|
-
|
|
62221
|
-
|
|
62222
|
-
|
|
62223
|
-
|
|
62224
|
-
|
|
62225
|
-
attributeName = cookieAv;
|
|
62226
|
-
}
|
|
62227
|
-
attributeName = attributeName.trim();
|
|
62228
|
-
attributeValue = attributeValue.trim();
|
|
62229
|
-
if (attributeValue.length > maxAttributeValueSize) {
|
|
62230
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62231
|
-
}
|
|
62232
|
-
const attributeNameLowercase = attributeName.toLowerCase();
|
|
62233
|
-
if (attributeNameLowercase === "expires") {
|
|
62234
|
-
const expiryTime = new Date(attributeValue);
|
|
62235
|
-
cookieAttributeList.expires = expiryTime;
|
|
62236
|
-
} else if (attributeNameLowercase === "max-age") {
|
|
62237
|
-
const charCode = attributeValue.charCodeAt(0);
|
|
62238
|
-
if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") {
|
|
62239
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62240
|
-
}
|
|
62241
|
-
if (!/^\d+$/.test(attributeValue)) {
|
|
62242
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62243
|
-
}
|
|
62244
|
-
const deltaSeconds = Number(attributeValue);
|
|
62245
|
-
cookieAttributeList.maxAge = deltaSeconds;
|
|
62246
|
-
} else if (attributeNameLowercase === "domain") {
|
|
62247
|
-
let cookieDomain = attributeValue;
|
|
62248
|
-
if (cookieDomain[0] === ".") {
|
|
62249
|
-
cookieDomain = cookieDomain.slice(1);
|
|
62250
|
-
}
|
|
62251
|
-
cookieDomain = cookieDomain.toLowerCase();
|
|
62252
|
-
cookieAttributeList.domain = cookieDomain;
|
|
62253
|
-
} else if (attributeNameLowercase === "path") {
|
|
62254
|
-
let cookiePath = "";
|
|
62255
|
-
if (attributeValue.length === 0 || attributeValue[0] !== "/") {
|
|
62256
|
-
cookiePath = "/";
|
|
62532
|
+
while (true) {
|
|
62533
|
+
if (unparsedAttributes.length === 0) {
|
|
62534
|
+
return cookieAttributeList;
|
|
62535
|
+
}
|
|
62536
|
+
assert(unparsedAttributes[0] === ";");
|
|
62537
|
+
unparsedAttributes = unparsedAttributes.slice(1);
|
|
62538
|
+
let cookieAv = "";
|
|
62539
|
+
if (unparsedAttributes.includes(";")) {
|
|
62540
|
+
cookieAv = collectASequenceOfCodePointsFast(
|
|
62541
|
+
";",
|
|
62542
|
+
unparsedAttributes,
|
|
62543
|
+
{ position: 0 }
|
|
62544
|
+
);
|
|
62545
|
+
unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
|
|
62546
|
+
} else {
|
|
62547
|
+
cookieAv = unparsedAttributes;
|
|
62548
|
+
unparsedAttributes = "";
|
|
62549
|
+
}
|
|
62550
|
+
let attributeName = "";
|
|
62551
|
+
let attributeValue = "";
|
|
62552
|
+
if (cookieAv.includes("=")) {
|
|
62553
|
+
const position = { position: 0 };
|
|
62554
|
+
attributeName = collectASequenceOfCodePointsFast(
|
|
62555
|
+
"=",
|
|
62556
|
+
cookieAv,
|
|
62557
|
+
position
|
|
62558
|
+
);
|
|
62559
|
+
attributeValue = cookieAv.slice(position.position + 1);
|
|
62257
62560
|
} else {
|
|
62258
|
-
|
|
62259
|
-
}
|
|
62260
|
-
|
|
62261
|
-
|
|
62262
|
-
|
|
62263
|
-
|
|
62264
|
-
|
|
62265
|
-
|
|
62266
|
-
|
|
62267
|
-
|
|
62268
|
-
cookieAttributeList.
|
|
62269
|
-
} else if (
|
|
62270
|
-
|
|
62271
|
-
|
|
62272
|
-
|
|
62561
|
+
attributeName = cookieAv;
|
|
62562
|
+
}
|
|
62563
|
+
attributeName = attributeName.trim();
|
|
62564
|
+
attributeValue = attributeValue.trim();
|
|
62565
|
+
if (attributeValue.length > maxAttributeValueSize) {
|
|
62566
|
+
continue;
|
|
62567
|
+
}
|
|
62568
|
+
const attributeNameLowercase = attributeName.toLowerCase();
|
|
62569
|
+
if (attributeNameLowercase === "expires") {
|
|
62570
|
+
const expiryTime = new Date(attributeValue);
|
|
62571
|
+
cookieAttributeList.expires = expiryTime;
|
|
62572
|
+
} else if (attributeNameLowercase === "max-age") {
|
|
62573
|
+
const charCode = attributeValue.charCodeAt(0);
|
|
62574
|
+
if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") {
|
|
62575
|
+
continue;
|
|
62576
|
+
}
|
|
62577
|
+
if (!/^\d+$/.test(attributeValue)) {
|
|
62578
|
+
continue;
|
|
62579
|
+
}
|
|
62580
|
+
const deltaSeconds = Number(attributeValue);
|
|
62581
|
+
cookieAttributeList.maxAge = deltaSeconds;
|
|
62582
|
+
} else if (attributeNameLowercase === "domain") {
|
|
62583
|
+
let cookieDomain = attributeValue;
|
|
62584
|
+
if (cookieDomain[0] === ".") {
|
|
62585
|
+
cookieDomain = cookieDomain.slice(1);
|
|
62586
|
+
}
|
|
62587
|
+
cookieDomain = cookieDomain.toLowerCase();
|
|
62588
|
+
cookieAttributeList.domain = cookieDomain;
|
|
62589
|
+
} else if (attributeNameLowercase === "path") {
|
|
62590
|
+
let cookiePath = "";
|
|
62591
|
+
if (attributeValue.length === 0 || attributeValue[0] !== "/") {
|
|
62592
|
+
cookiePath = "/";
|
|
62593
|
+
} else {
|
|
62594
|
+
cookiePath = attributeValue;
|
|
62595
|
+
}
|
|
62596
|
+
cookieAttributeList.path = cookiePath;
|
|
62597
|
+
} else if (attributeNameLowercase === "secure") {
|
|
62598
|
+
cookieAttributeList.secure = true;
|
|
62599
|
+
} else if (attributeNameLowercase === "httponly") {
|
|
62600
|
+
cookieAttributeList.httpOnly = true;
|
|
62601
|
+
} else if (attributeNameLowercase === "samesite") {
|
|
62602
|
+
const attributeValueLowercase = attributeValue.toLowerCase();
|
|
62603
|
+
if (attributeValueLowercase === "none") {
|
|
62604
|
+
cookieAttributeList.sameSite = "None";
|
|
62605
|
+
} else if (attributeValueLowercase === "strict") {
|
|
62606
|
+
cookieAttributeList.sameSite = "Strict";
|
|
62607
|
+
} else if (attributeValueLowercase === "lax") {
|
|
62608
|
+
cookieAttributeList.sameSite = "Lax";
|
|
62609
|
+
}
|
|
62610
|
+
} else {
|
|
62611
|
+
cookieAttributeList.unparsed ??= [];
|
|
62612
|
+
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
|
|
62273
62613
|
}
|
|
62274
|
-
} else {
|
|
62275
|
-
cookieAttributeList.unparsed ??= [];
|
|
62276
|
-
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
|
|
62277
62614
|
}
|
|
62278
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62279
62615
|
}
|
|
62280
62616
|
module2.exports = {
|
|
62281
62617
|
parseSetCookie,
|
|
@@ -62297,7 +62633,7 @@ var require_cookies = __commonJS({
|
|
|
62297
62633
|
webidl.argumentLengthCheck(arguments, 1, "getCookies");
|
|
62298
62634
|
brandChecks(headers);
|
|
62299
62635
|
const cookie = headers.get("cookie");
|
|
62300
|
-
const out = {};
|
|
62636
|
+
const out = { __proto__: null };
|
|
62301
62637
|
if (!cookie) {
|
|
62302
62638
|
return out;
|
|
62303
62639
|
}
|
|
@@ -63073,11 +63409,11 @@ var require_connection = __commonJS({
|
|
|
63073
63409
|
processResponse(response) {
|
|
63074
63410
|
if (response.type === "error" || response.status !== 101) {
|
|
63075
63411
|
if (response.socket?.session == null) {
|
|
63076
|
-
|
|
63412
|
+
failHandshake(handler, response, 1002, "Received network error or non-101 status code.", response.error);
|
|
63077
63413
|
return;
|
|
63078
63414
|
}
|
|
63079
63415
|
if (response.status !== 200) {
|
|
63080
|
-
|
|
63416
|
+
failHandshake(handler, response, 1002, "Received network error or non-200 status code.", response.error);
|
|
63081
63417
|
return;
|
|
63082
63418
|
}
|
|
63083
63419
|
}
|
|
@@ -63086,21 +63422,21 @@ var require_connection = __commonJS({
|
|
|
63086
63422
|
warningEmitted = true;
|
|
63087
63423
|
}
|
|
63088
63424
|
if (protocols.length !== 0 && !response.headersList.get("Sec-WebSocket-Protocol")) {
|
|
63089
|
-
|
|
63425
|
+
failHandshake(handler, response, 1002, "Server did not respond with sent protocols.");
|
|
63090
63426
|
return;
|
|
63091
63427
|
}
|
|
63092
63428
|
if (response.socket.session == null && response.headersList.get("Upgrade")?.toLowerCase() !== "websocket") {
|
|
63093
|
-
|
|
63429
|
+
failHandshake(handler, response, 1002, 'Server did not set Upgrade header to "websocket".');
|
|
63094
63430
|
return;
|
|
63095
63431
|
}
|
|
63096
63432
|
if (response.socket.session == null && response.headersList.get("Connection")?.toLowerCase() !== "upgrade") {
|
|
63097
|
-
|
|
63433
|
+
failHandshake(handler, response, 1002, 'Server did not set Connection header to "upgrade".');
|
|
63098
63434
|
return;
|
|
63099
63435
|
}
|
|
63100
63436
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
63101
63437
|
const digest = crypto12.hash("sha1", keyValue + uid, "base64");
|
|
63102
63438
|
if (secWSAccept !== digest) {
|
|
63103
|
-
|
|
63439
|
+
failHandshake(handler, response, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
63104
63440
|
return;
|
|
63105
63441
|
}
|
|
63106
63442
|
const secExtension = response.headersList.get("Sec-WebSocket-Extensions");
|
|
@@ -63108,7 +63444,7 @@ var require_connection = __commonJS({
|
|
|
63108
63444
|
if (secExtension !== null) {
|
|
63109
63445
|
extensions = parseExtensions(secExtension);
|
|
63110
63446
|
if (!extensions.has("permessage-deflate")) {
|
|
63111
|
-
|
|
63447
|
+
failHandshake(handler, response, 1002, "Sec-WebSocket-Extensions header does not match.");
|
|
63112
63448
|
return;
|
|
63113
63449
|
}
|
|
63114
63450
|
}
|
|
@@ -63116,7 +63452,7 @@ var require_connection = __commonJS({
|
|
|
63116
63452
|
if (secProtocol !== null) {
|
|
63117
63453
|
const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList);
|
|
63118
63454
|
if (requestProtocols === null || !requestProtocols.includes(secProtocol)) {
|
|
63119
|
-
|
|
63455
|
+
failHandshake(handler, response, 1002, "Protocol was not set in the opening handshake.");
|
|
63120
63456
|
return;
|
|
63121
63457
|
}
|
|
63122
63458
|
}
|
|
@@ -63162,6 +63498,12 @@ var require_connection = __commonJS({
|
|
|
63162
63498
|
object.readyState = states.CLOSING;
|
|
63163
63499
|
}
|
|
63164
63500
|
}
|
|
63501
|
+
function failHandshake(handler, response, code2, reason, cause) {
|
|
63502
|
+
if (response.socket?.session != null && !response.socket.destroyed) {
|
|
63503
|
+
response.socket.destroy();
|
|
63504
|
+
}
|
|
63505
|
+
failWebsocketConnection(handler, code2, reason, cause);
|
|
63506
|
+
}
|
|
63165
63507
|
function failWebsocketConnection(handler, code2, reason, cause) {
|
|
63166
63508
|
if (isEstablished(handler.readyState)) {
|
|
63167
63509
|
closeWebSocketConnection(handler, code2, reason, false);
|
|
@@ -63440,6 +63782,15 @@ var require_receiver = __commonJS({
|
|
|
63440
63782
|
if (isControlFrame(this.#info.opcode)) {
|
|
63441
63783
|
this.#loop = this.parseControlFrame(body);
|
|
63442
63784
|
this.#state = parserStates.INFO;
|
|
63785
|
+
if (this.#loop && this.#handler.socket.writableNeedDrain) {
|
|
63786
|
+
this.#loop = false;
|
|
63787
|
+
this.#handler.socket.once("drain", () => {
|
|
63788
|
+
if (this.destroyed) return;
|
|
63789
|
+
this.#loop = true;
|
|
63790
|
+
this.run(callback);
|
|
63791
|
+
});
|
|
63792
|
+
return;
|
|
63793
|
+
}
|
|
63443
63794
|
} else {
|
|
63444
63795
|
if (!this.#info.compressed) {
|
|
63445
63796
|
if (!this.writeFragments(body)) {
|
|
@@ -64615,6 +64966,7 @@ var require_util6 = __commonJS({
|
|
|
64615
64966
|
var require_eventsource_stream = __commonJS({
|
|
64616
64967
|
"node_modules/undici/lib/web/eventsource/eventsource-stream.js"(exports2, module2) {
|
|
64617
64968
|
"use strict";
|
|
64969
|
+
var buffer = require("buffer");
|
|
64618
64970
|
var { Transform } = require("stream");
|
|
64619
64971
|
var { isASCIINumber, isValidLastEventId } = require_util6();
|
|
64620
64972
|
var BOM = [239, 187, 191];
|
|
@@ -64622,24 +64974,28 @@ var require_eventsource_stream = __commonJS({
|
|
|
64622
64974
|
var CR = 13;
|
|
64623
64975
|
var COLON = 58;
|
|
64624
64976
|
var SPACE = 32;
|
|
64977
|
+
var defaultMaxEventSize = buffer.kStringMaxLength;
|
|
64625
64978
|
var DATA = Buffer.from("data");
|
|
64626
64979
|
var EVENT = Buffer.from("event");
|
|
64627
64980
|
var ID = Buffer.from("id");
|
|
64628
64981
|
var RETRY = Buffer.from("retry");
|
|
64629
|
-
|
|
64630
|
-
|
|
64982
|
+
var minParserItems = 1024;
|
|
64983
|
+
var maxParserItems = 131072;
|
|
64984
|
+
var bytesPerParserItem = 128;
|
|
64985
|
+
function isASCIINumberBytes(buffer2, start) {
|
|
64986
|
+
if (start >= buffer2.length) {
|
|
64631
64987
|
return false;
|
|
64632
64988
|
}
|
|
64633
|
-
for (let i = start; i <
|
|
64634
|
-
if (
|
|
64989
|
+
for (let i = start; i < buffer2.length; i++) {
|
|
64990
|
+
if (buffer2[i] < 48 || buffer2[i] > 57) {
|
|
64635
64991
|
return false;
|
|
64636
64992
|
}
|
|
64637
64993
|
}
|
|
64638
64994
|
return true;
|
|
64639
64995
|
}
|
|
64640
|
-
function isValidLastEventIdBytes(
|
|
64641
|
-
for (let i = start; i <
|
|
64642
|
-
if (
|
|
64996
|
+
function isValidLastEventIdBytes(buffer2, start) {
|
|
64997
|
+
for (let i = start; i < buffer2.length; i++) {
|
|
64998
|
+
if (buffer2[i] === 0) {
|
|
64643
64999
|
return false;
|
|
64644
65000
|
}
|
|
64645
65001
|
}
|
|
@@ -64656,6 +65012,11 @@ var require_eventsource_stream = __commonJS({
|
|
|
64656
65012
|
}
|
|
64657
65013
|
return true;
|
|
64658
65014
|
}
|
|
65015
|
+
function createMaxEventSizeExceededError() {
|
|
65016
|
+
const error = new Error("EventSource message size exceeded");
|
|
65017
|
+
error.aborted = false;
|
|
65018
|
+
return error;
|
|
65019
|
+
}
|
|
64659
65020
|
var EventSourceStream = class extends Transform {
|
|
64660
65021
|
/**
|
|
64661
65022
|
* @type {eventSourceSettings}
|
|
@@ -64682,6 +65043,13 @@ var require_eventsource_stream = __commonJS({
|
|
|
64682
65043
|
pos = 0;
|
|
64683
65044
|
lineChunkIndex = 0;
|
|
64684
65045
|
linePos = 0;
|
|
65046
|
+
lineLength = 0;
|
|
65047
|
+
eventSize = 0;
|
|
65048
|
+
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 };
|
|
65049
|
+
dataLineCount = 0;
|
|
65050
|
+
maxEventSize;
|
|
65051
|
+
maxDataLines;
|
|
65052
|
+
maxBufferedChunks;
|
|
64685
65053
|
event = {
|
|
64686
65054
|
data: void 0,
|
|
64687
65055
|
event: void 0,
|
|
@@ -64691,6 +65059,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
64691
65059
|
/**
|
|
64692
65060
|
* @param {object} options
|
|
64693
65061
|
* @param {boolean} [options.readableObjectMode]
|
|
65062
|
+
* @param {number} [options.maxEventSize]
|
|
64694
65063
|
* @param {eventSourceSettings} [options.eventSourceSettings]
|
|
64695
65064
|
* @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
|
|
64696
65065
|
*/
|
|
@@ -64698,6 +65067,10 @@ var require_eventsource_stream = __commonJS({
|
|
|
64698
65067
|
options.readableObjectMode = true;
|
|
64699
65068
|
super(options);
|
|
64700
65069
|
this.state = options.eventSourceSettings || {};
|
|
65070
|
+
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize;
|
|
65071
|
+
const parserItemLimit = this.maxEventSize > 0 ? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem))) : 0;
|
|
65072
|
+
this.maxDataLines = parserItemLimit;
|
|
65073
|
+
this.maxBufferedChunks = parserItemLimit;
|
|
64701
65074
|
if (options.push) {
|
|
64702
65075
|
this.push = options.push;
|
|
64703
65076
|
}
|
|
@@ -64713,6 +65086,10 @@ var require_eventsource_stream = __commonJS({
|
|
|
64713
65086
|
callback();
|
|
64714
65087
|
return;
|
|
64715
65088
|
}
|
|
65089
|
+
if (this.maxEventSize > 0 && this.chunks.length >= this.maxBufferedChunks && chunk2[0] !== LF && chunk2[0] !== CR) {
|
|
65090
|
+
callback(createMaxEventSizeExceededError());
|
|
65091
|
+
return;
|
|
65092
|
+
}
|
|
64716
65093
|
this.chunks.push(chunk2);
|
|
64717
65094
|
if (this.checkBOM) {
|
|
64718
65095
|
if (this.handleBOM()) {
|
|
@@ -64749,15 +65126,29 @@ var require_eventsource_stream = __commonJS({
|
|
|
64749
65126
|
if (byte === CR) {
|
|
64750
65127
|
this.crlfCheck = true;
|
|
64751
65128
|
}
|
|
64752
|
-
|
|
65129
|
+
try {
|
|
65130
|
+
this.parseLine(this.readLine(), this.event);
|
|
65131
|
+
} catch (error) {
|
|
65132
|
+
callback(error);
|
|
65133
|
+
return;
|
|
65134
|
+
}
|
|
64753
65135
|
this.consumeCurrentByte();
|
|
64754
65136
|
this.eventEndCheck = true;
|
|
64755
65137
|
continue;
|
|
64756
65138
|
}
|
|
65139
|
+
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
|
65140
|
+
callback(createMaxEventSizeExceededError());
|
|
65141
|
+
return;
|
|
65142
|
+
}
|
|
64757
65143
|
this.advanceCursor();
|
|
64758
65144
|
}
|
|
64759
65145
|
callback();
|
|
64760
65146
|
}
|
|
65147
|
+
_destroy(error, callback) {
|
|
65148
|
+
this.chunks.length = 0;
|
|
65149
|
+
this.clearEvent();
|
|
65150
|
+
super._destroy(error, callback);
|
|
65151
|
+
}
|
|
64761
65152
|
/**
|
|
64762
65153
|
* @param {Buffer} line
|
|
64763
65154
|
* @param {EventSourceStreamEvent} event
|
|
@@ -64780,6 +65171,12 @@ var require_eventsource_stream = __commonJS({
|
|
|
64780
65171
|
}
|
|
64781
65172
|
}
|
|
64782
65173
|
if (isFieldName(line, fieldLength, DATA)) {
|
|
65174
|
+
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
|
65175
|
+
throw createMaxEventSizeExceededError();
|
|
65176
|
+
}
|
|
65177
|
+
const valueBytes = line.length - valueStart;
|
|
65178
|
+
const dataSize = this.eventFieldSizes.data + (event.data === void 0 ? 0 : 1) + valueBytes;
|
|
65179
|
+
this.setEventFieldSize("data", dataSize);
|
|
64783
65180
|
const value = line.toString("utf8", valueStart);
|
|
64784
65181
|
if (event.data === void 0) {
|
|
64785
65182
|
event.data = value;
|
|
@@ -64787,27 +65184,38 @@ var require_eventsource_stream = __commonJS({
|
|
|
64787
65184
|
event.data += `
|
|
64788
65185
|
${value}`;
|
|
64789
65186
|
}
|
|
65187
|
+
this.dataLineCount++;
|
|
64790
65188
|
return;
|
|
64791
65189
|
}
|
|
64792
65190
|
if (isFieldName(line, fieldLength, RETRY)) {
|
|
64793
65191
|
if (isASCIINumberBytes(line, valueStart)) {
|
|
65192
|
+
this.setEventFieldSize("retry", line.length - valueStart);
|
|
64794
65193
|
event.retry = line.toString("utf8", valueStart);
|
|
64795
65194
|
}
|
|
64796
65195
|
return;
|
|
64797
65196
|
}
|
|
64798
65197
|
if (isFieldName(line, fieldLength, ID)) {
|
|
64799
65198
|
if (isValidLastEventIdBytes(line, valueStart)) {
|
|
65199
|
+
this.setEventFieldSize("id", line.length - valueStart);
|
|
64800
65200
|
event.id = line.toString("utf8", valueStart);
|
|
64801
65201
|
}
|
|
64802
65202
|
return;
|
|
64803
65203
|
}
|
|
64804
65204
|
if (isFieldName(line, fieldLength, EVENT)) {
|
|
64805
|
-
|
|
64806
|
-
|
|
64807
|
-
event.event =
|
|
65205
|
+
if (valueStart < line.length) {
|
|
65206
|
+
this.setEventFieldSize("event", line.length - valueStart);
|
|
65207
|
+
event.event = line.toString("utf8", valueStart);
|
|
64808
65208
|
}
|
|
64809
65209
|
}
|
|
64810
65210
|
}
|
|
65211
|
+
setEventFieldSize(field, size) {
|
|
65212
|
+
const eventSize = this.eventSize - this.eventFieldSizes[field] + size;
|
|
65213
|
+
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
|
|
65214
|
+
throw createMaxEventSizeExceededError();
|
|
65215
|
+
}
|
|
65216
|
+
this.eventSize = eventSize;
|
|
65217
|
+
this.eventFieldSizes[field] = size;
|
|
65218
|
+
}
|
|
64811
65219
|
/**
|
|
64812
65220
|
* @param {EventSourceStreamEvent} event
|
|
64813
65221
|
*/
|
|
@@ -64834,6 +65242,12 @@ ${value}`;
|
|
|
64834
65242
|
this.event.event = void 0;
|
|
64835
65243
|
this.event.id = void 0;
|
|
64836
65244
|
this.event.retry = void 0;
|
|
65245
|
+
this.eventSize = 0;
|
|
65246
|
+
this.dataLineCount = 0;
|
|
65247
|
+
this.eventFieldSizes.data = 0;
|
|
65248
|
+
this.eventFieldSizes.event = 0;
|
|
65249
|
+
this.eventFieldSizes.id = 0;
|
|
65250
|
+
this.eventFieldSizes.retry = 0;
|
|
64837
65251
|
}
|
|
64838
65252
|
hasPendingEvent() {
|
|
64839
65253
|
return this.event.data !== void 0 || this.event.event !== void 0 || this.event.id !== void 0 || this.event.retry !== void 0;
|
|
@@ -64858,13 +65272,15 @@ ${value}`;
|
|
|
64858
65272
|
syncLineStartToCursor() {
|
|
64859
65273
|
this.lineChunkIndex = this.chunkIndex;
|
|
64860
65274
|
this.linePos = this.pos;
|
|
65275
|
+
this.lineLength = 0;
|
|
64861
65276
|
this.dropConsumedChunks();
|
|
64862
65277
|
}
|
|
64863
65278
|
dropConsumedChunks() {
|
|
64864
|
-
|
|
64865
|
-
this.
|
|
64866
|
-
this.
|
|
64867
|
-
this.
|
|
65279
|
+
if (this.lineChunkIndex > 0) {
|
|
65280
|
+
const consumed = this.lineChunkIndex;
|
|
65281
|
+
this.chunks.splice(0, consumed);
|
|
65282
|
+
this.lineChunkIndex = 0;
|
|
65283
|
+
this.chunkIndex -= consumed;
|
|
64868
65284
|
}
|
|
64869
65285
|
if (this.chunkIndex === this.chunks.length) {
|
|
64870
65286
|
this.chunks.length = 0;
|
|
@@ -64966,6 +65382,7 @@ var require_eventsource = __commonJS({
|
|
|
64966
65382
|
var { isNetworkError } = require_response();
|
|
64967
65383
|
var { kEnumerableProperty } = require_util();
|
|
64968
65384
|
var { environmentSettingsObject } = require_util2();
|
|
65385
|
+
var { getGlobalDispatcher } = require_global2();
|
|
64969
65386
|
var experimentalWarned = false;
|
|
64970
65387
|
var defaultReconnectionTime = 3e3;
|
|
64971
65388
|
var CONNECTING = 0;
|
|
@@ -65107,6 +65524,7 @@ var require_eventsource = __commonJS({
|
|
|
65107
65524
|
this.#state.origin = response.urlList[response.urlList.length - 1].origin;
|
|
65108
65525
|
const eventSourceStream = new EventSourceStream({
|
|
65109
65526
|
eventSourceSettings: this.#state,
|
|
65527
|
+
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
|
65110
65528
|
push: (event) => {
|
|
65111
65529
|
this.dispatchEvent(createFastMessageEvent(
|
|
65112
65530
|
event.type,
|
|
@@ -65243,7 +65661,8 @@ var require_eventsource = __commonJS({
|
|
|
65243
65661
|
{
|
|
65244
65662
|
key: "dispatcher",
|
|
65245
65663
|
// undici only
|
|
65246
|
-
converter: webidl.converters.any
|
|
65664
|
+
converter: webidl.converters.any,
|
|
65665
|
+
defaultValue: () => getGlobalDispatcher()
|
|
65247
65666
|
},
|
|
65248
65667
|
{
|
|
65249
65668
|
key: "node",
|