@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.mjs
CHANGED
|
@@ -39601,6 +39601,7 @@ var require_symbols = __commonJS({
|
|
|
39601
39601
|
kDestroy: /* @__PURE__ */ Symbol("destroy"),
|
|
39602
39602
|
kDispatch: /* @__PURE__ */ Symbol("dispatch"),
|
|
39603
39603
|
kUrl: /* @__PURE__ */ Symbol("url"),
|
|
39604
|
+
kRedirectCacheControl: /* @__PURE__ */ Symbol("redirect cache control"),
|
|
39604
39605
|
kWriting: /* @__PURE__ */ Symbol("writing"),
|
|
39605
39606
|
kResuming: /* @__PURE__ */ Symbol("resuming"),
|
|
39606
39607
|
kQueue: /* @__PURE__ */ Symbol("queue"),
|
|
@@ -41895,10 +41896,27 @@ var require_request = __commonJS({
|
|
|
41895
41896
|
return false;
|
|
41896
41897
|
}
|
|
41897
41898
|
}
|
|
41898
|
-
|
|
41899
|
+
/**
|
|
41900
|
+
* @param {number} statusCode
|
|
41901
|
+
* @param {Buffer[]|string[]} headers
|
|
41902
|
+
* @param {import('node:stream').Duplex} socket
|
|
41903
|
+
* @param {string} [statusText]
|
|
41904
|
+
*/
|
|
41905
|
+
onUpgrade(statusCode, headers, socket, statusText = "") {
|
|
41906
|
+
this.onFinally();
|
|
41899
41907
|
assert(!this.aborted);
|
|
41900
41908
|
assert(!this.completed);
|
|
41901
|
-
|
|
41909
|
+
if (channels.headers.hasSubscribers) {
|
|
41910
|
+
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
|
|
41911
|
+
}
|
|
41912
|
+
const result = this[kHandler].onUpgrade(statusCode, headers, socket);
|
|
41913
|
+
if (!this.aborted) {
|
|
41914
|
+
this.completed = true;
|
|
41915
|
+
if (channels.trailers.hasSubscribers) {
|
|
41916
|
+
channels.trailers.publish({ request: this, trailers: [] });
|
|
41917
|
+
}
|
|
41918
|
+
}
|
|
41919
|
+
return result;
|
|
41902
41920
|
}
|
|
41903
41921
|
onComplete(trailers) {
|
|
41904
41922
|
this.onFinally();
|
|
@@ -42248,6 +42266,7 @@ var require_unwrap_handler = __commonJS({
|
|
|
42248
42266
|
var require_dispatcher_base = __commonJS({
|
|
42249
42267
|
"node_modules/undici/lib/dispatcher/dispatcher-base.js"(exports, module) {
|
|
42250
42268
|
"use strict";
|
|
42269
|
+
var buffer = __require("buffer");
|
|
42251
42270
|
var Dispatcher = require_dispatcher();
|
|
42252
42271
|
var UnwrapHandler = require_unwrap_handler();
|
|
42253
42272
|
var {
|
|
@@ -42259,6 +42278,7 @@ var require_dispatcher_base = __commonJS({
|
|
|
42259
42278
|
var kOnDestroyed = /* @__PURE__ */ Symbol("onDestroyed");
|
|
42260
42279
|
var kOnClosed = /* @__PURE__ */ Symbol("onClosed");
|
|
42261
42280
|
var kWebSocketOptions = /* @__PURE__ */ Symbol("webSocketOptions");
|
|
42281
|
+
var kEventSourceOptions = /* @__PURE__ */ Symbol("eventSourceOptions");
|
|
42262
42282
|
var DispatcherBase = class extends Dispatcher {
|
|
42263
42283
|
/** @type {boolean} */
|
|
42264
42284
|
[kDestroyed] = false;
|
|
@@ -42274,6 +42294,7 @@ var require_dispatcher_base = __commonJS({
|
|
|
42274
42294
|
constructor(opts) {
|
|
42275
42295
|
super();
|
|
42276
42296
|
this[kWebSocketOptions] = opts?.webSocket ?? {};
|
|
42297
|
+
this[kEventSourceOptions] = opts?.eventSource ?? {};
|
|
42277
42298
|
}
|
|
42278
42299
|
/**
|
|
42279
42300
|
* @returns {import('../../types/dispatcher').WebSocketOptions}
|
|
@@ -42285,6 +42306,14 @@ var require_dispatcher_base = __commonJS({
|
|
|
42285
42306
|
// 128 MB default
|
|
42286
42307
|
};
|
|
42287
42308
|
}
|
|
42309
|
+
/**
|
|
42310
|
+
* @returns {import('../../types/client').Client.EventSourceOptions}
|
|
42311
|
+
*/
|
|
42312
|
+
get eventSourceOptions() {
|
|
42313
|
+
return {
|
|
42314
|
+
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
|
|
42315
|
+
};
|
|
42316
|
+
}
|
|
42288
42317
|
/** @returns {boolean} */
|
|
42289
42318
|
get destroyed() {
|
|
42290
42319
|
return this[kDestroyed];
|
|
@@ -42430,15 +42459,19 @@ var require_connect = __commonJS({
|
|
|
42430
42459
|
if (this._sessionCache.has(sessionKey)) {
|
|
42431
42460
|
this._sessionCache.delete(sessionKey);
|
|
42432
42461
|
} else if (this._sessionCache.size >= this._maxCachedSessions) {
|
|
42462
|
+
let evicted = false;
|
|
42433
42463
|
for (const [key, ref] of this._sessionCache) {
|
|
42434
42464
|
if (ref.deref() === void 0) {
|
|
42435
42465
|
this._sessionCache.delete(key);
|
|
42436
|
-
|
|
42466
|
+
evicted = true;
|
|
42467
|
+
break;
|
|
42437
42468
|
}
|
|
42438
42469
|
}
|
|
42439
|
-
|
|
42440
|
-
|
|
42441
|
-
|
|
42470
|
+
if (!evicted) {
|
|
42471
|
+
const oldest = this._sessionCache.keys().next();
|
|
42472
|
+
if (!oldest.done) {
|
|
42473
|
+
this._sessionCache.delete(oldest.value);
|
|
42474
|
+
}
|
|
42442
42475
|
}
|
|
42443
42476
|
}
|
|
42444
42477
|
this._sessionCache.set(sessionKey, new WeakRef(session));
|
|
@@ -43497,6 +43530,10 @@ var require_infra = __commonJS({
|
|
|
43497
43530
|
return input.slice(start, position.position);
|
|
43498
43531
|
}
|
|
43499
43532
|
var ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g;
|
|
43533
|
+
var nonASCIIRegex = /[^\x00-\x7F]/;
|
|
43534
|
+
function asciiLowercase(str2) {
|
|
43535
|
+
return nonASCIIRegex.test(str2) ? str2.replace(/[A-Z]+/g, (upper) => upper.toLowerCase()) : str2.toLowerCase();
|
|
43536
|
+
}
|
|
43500
43537
|
function forgivingBase64(data) {
|
|
43501
43538
|
data = data.replace(ASCII_WHITESPACE_REPLACE_REGEX, "");
|
|
43502
43539
|
let dataLength = data.length;
|
|
@@ -43571,6 +43608,7 @@ var require_infra = __commonJS({
|
|
|
43571
43608
|
return result;
|
|
43572
43609
|
}
|
|
43573
43610
|
module.exports = {
|
|
43611
|
+
asciiLowercase,
|
|
43574
43612
|
collectASequenceOfCodePoints,
|
|
43575
43613
|
collectASequenceOfCodePointsFast,
|
|
43576
43614
|
forgivingBase64,
|
|
@@ -46195,7 +46233,13 @@ var require_client_h1 = __commonJS({
|
|
|
46195
46233
|
function lazyllhttp() {
|
|
46196
46234
|
const llhttpWasmData = process.env.JEST_WORKER_ID ? require_llhttp_wasm() : void 0;
|
|
46197
46235
|
let mod;
|
|
46198
|
-
let useWasmSIMD =
|
|
46236
|
+
let useWasmSIMD = true;
|
|
46237
|
+
if (process.arch === "ppc64") {
|
|
46238
|
+
const [major, minor] = process.versions.node.split(".").map((n) => parseInt(n, 10));
|
|
46239
|
+
if (major < 24 || major === 24 && minor < 12) {
|
|
46240
|
+
useWasmSIMD = false;
|
|
46241
|
+
}
|
|
46242
|
+
}
|
|
46199
46243
|
if (process.env.UNDICI_NO_WASM_SIMD === "1") {
|
|
46200
46244
|
useWasmSIMD = false;
|
|
46201
46245
|
} else if (process.env.UNDICI_NO_WASM_SIMD === "0") {
|
|
@@ -46549,7 +46593,7 @@ var require_client_h1 = __commonJS({
|
|
|
46549
46593
|
* @param {Buffer} head
|
|
46550
46594
|
*/
|
|
46551
46595
|
onUpgrade(head) {
|
|
46552
|
-
const { upgrade, client, socket, headers, statusCode } = this;
|
|
46596
|
+
const { upgrade, client, socket, headers, statusCode, statusText } = this;
|
|
46553
46597
|
assert(upgrade);
|
|
46554
46598
|
assert(client[kSocket] === socket);
|
|
46555
46599
|
assert(!socket.destroyed);
|
|
@@ -46574,8 +46618,9 @@ var require_client_h1 = __commonJS({
|
|
|
46574
46618
|
client[kQueue][client[kRunningIdx]++] = null;
|
|
46575
46619
|
client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade"));
|
|
46576
46620
|
try {
|
|
46577
|
-
request2.onUpgrade(statusCode, headers, socket);
|
|
46621
|
+
request2.onUpgrade(statusCode, headers, socket, statusText);
|
|
46578
46622
|
} catch (err2) {
|
|
46623
|
+
util.errorRequest(client, request2, err2);
|
|
46579
46624
|
util.destroy(socket, err2);
|
|
46580
46625
|
}
|
|
46581
46626
|
client[kResume]();
|
|
@@ -46843,7 +46888,6 @@ var require_client_h1 = __commonJS({
|
|
|
46843
46888
|
};
|
|
46844
46889
|
}
|
|
46845
46890
|
function onHttpSocketError(err2) {
|
|
46846
|
-
assert(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
46847
46891
|
const parser = this[kParser];
|
|
46848
46892
|
if (err2.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
|
|
46849
46893
|
const parserErr = parser.finish();
|
|
@@ -47623,7 +47667,6 @@ var require_client_h2 = __commonJS({
|
|
|
47623
47667
|
}
|
|
47624
47668
|
}
|
|
47625
47669
|
function onHttp2SessionError(err2) {
|
|
47626
|
-
assert(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
47627
47670
|
this[kSocket][kError] = err2;
|
|
47628
47671
|
this[kClient][kOnError](err2);
|
|
47629
47672
|
}
|
|
@@ -47713,7 +47756,6 @@ var require_client_h2 = __commonJS({
|
|
|
47713
47756
|
client[kResume]();
|
|
47714
47757
|
}
|
|
47715
47758
|
function onHttp2SocketError(err2) {
|
|
47716
|
-
assert(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
47717
47759
|
this[kError] = err2;
|
|
47718
47760
|
this[kClient][kOnError](err2);
|
|
47719
47761
|
}
|
|
@@ -47807,10 +47849,15 @@ var require_client_h2 = __commonJS({
|
|
|
47807
47849
|
}
|
|
47808
47850
|
stream = session.request(headers, { endStream: false, signal });
|
|
47809
47851
|
stream[kHTTP2Stream] = true;
|
|
47852
|
+
++session[kOpenStreams];
|
|
47810
47853
|
stream.once("response", (headers2, _flags) => {
|
|
47811
47854
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2;
|
|
47812
|
-
|
|
47813
|
-
|
|
47855
|
+
try {
|
|
47856
|
+
request2.onUpgrade(statusCode, parseH2Headers(realHeaders), stream);
|
|
47857
|
+
} catch (err2) {
|
|
47858
|
+
abort(err2);
|
|
47859
|
+
return;
|
|
47860
|
+
}
|
|
47814
47861
|
completeRequest(client, request2);
|
|
47815
47862
|
});
|
|
47816
47863
|
stream.on("error", () => {
|
|
@@ -47827,10 +47874,15 @@ var require_client_h2 = __commonJS({
|
|
|
47827
47874
|
}
|
|
47828
47875
|
stream = session.request(headers, { endStream: false, signal });
|
|
47829
47876
|
stream[kHTTP2Stream] = true;
|
|
47877
|
+
++session[kOpenStreams];
|
|
47830
47878
|
stream.on("response", (headers2) => {
|
|
47831
47879
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2;
|
|
47832
|
-
|
|
47833
|
-
|
|
47880
|
+
try {
|
|
47881
|
+
request2.onUpgrade(statusCode, parseH2Headers(realHeaders), stream);
|
|
47882
|
+
} catch (err2) {
|
|
47883
|
+
abort(err2);
|
|
47884
|
+
return;
|
|
47885
|
+
}
|
|
47834
47886
|
completeRequest(client, request2);
|
|
47835
47887
|
});
|
|
47836
47888
|
stream.on("error", abort);
|
|
@@ -48264,7 +48316,8 @@ var require_client = __commonJS({
|
|
|
48264
48316
|
initialWindowSize,
|
|
48265
48317
|
connectionWindowSize,
|
|
48266
48318
|
pingInterval,
|
|
48267
|
-
webSocket
|
|
48319
|
+
webSocket,
|
|
48320
|
+
eventSource
|
|
48268
48321
|
} = {}) {
|
|
48269
48322
|
if (keepAlive !== void 0) {
|
|
48270
48323
|
throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
|
|
@@ -48342,7 +48395,7 @@ var require_client = __commonJS({
|
|
|
48342
48395
|
if (pingInterval != null && (typeof pingInterval !== "number" || !Number.isInteger(pingInterval) || pingInterval < 0)) {
|
|
48343
48396
|
throw new InvalidArgumentError("pingInterval must be a positive integer, greater or equal to 0");
|
|
48344
48397
|
}
|
|
48345
|
-
super({ webSocket });
|
|
48398
|
+
super({ webSocket, eventSource });
|
|
48346
48399
|
if (typeof connect2 !== "function") {
|
|
48347
48400
|
connect2 = buildConnector({
|
|
48348
48401
|
...tls,
|
|
@@ -49323,7 +49376,7 @@ var require_agent = __commonJS({
|
|
|
49323
49376
|
return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
|
|
49324
49377
|
}
|
|
49325
49378
|
var Agent = class extends DispatcherBase {
|
|
49326
|
-
constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
|
|
49379
|
+
constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
|
|
49327
49380
|
if (typeof factory !== "function") {
|
|
49328
49381
|
throw new InvalidArgumentError("factory must be a function.");
|
|
49329
49382
|
}
|
|
@@ -49337,7 +49390,10 @@ var require_agent = __commonJS({
|
|
|
49337
49390
|
if (connect && typeof connect !== "function") {
|
|
49338
49391
|
connect = { ...connect };
|
|
49339
49392
|
}
|
|
49340
|
-
|
|
49393
|
+
if (tls && typeof tls !== "function") {
|
|
49394
|
+
tls = { ...tls };
|
|
49395
|
+
}
|
|
49396
|
+
this[kOptions] = { ...util.deepClone(options), maxOrigins, connect, tls };
|
|
49341
49397
|
this[kFactory] = factory;
|
|
49342
49398
|
this[kClients] = /* @__PURE__ */ new Map();
|
|
49343
49399
|
this[kOrigins] = /* @__PURE__ */ new Set();
|
|
@@ -50546,6 +50602,55 @@ var require_retry_handler = __commonJS({
|
|
|
50546
50602
|
});
|
|
50547
50603
|
}
|
|
50548
50604
|
}
|
|
50605
|
+
var RetryController = class {
|
|
50606
|
+
#paused = false;
|
|
50607
|
+
#target = null;
|
|
50608
|
+
set target(target) {
|
|
50609
|
+
this.#target = target;
|
|
50610
|
+
if (this.#paused) {
|
|
50611
|
+
target?.pause();
|
|
50612
|
+
}
|
|
50613
|
+
}
|
|
50614
|
+
get target() {
|
|
50615
|
+
return this.#target;
|
|
50616
|
+
}
|
|
50617
|
+
pause() {
|
|
50618
|
+
this.#paused = true;
|
|
50619
|
+
this.#target?.pause();
|
|
50620
|
+
}
|
|
50621
|
+
resume() {
|
|
50622
|
+
this.#paused = false;
|
|
50623
|
+
this.#target?.resume();
|
|
50624
|
+
}
|
|
50625
|
+
abort(reason) {
|
|
50626
|
+
this.#target?.abort(reason);
|
|
50627
|
+
}
|
|
50628
|
+
get paused() {
|
|
50629
|
+
return this.#paused || (this.#target?.paused ?? false);
|
|
50630
|
+
}
|
|
50631
|
+
get aborted() {
|
|
50632
|
+
return this.#target?.aborted ?? false;
|
|
50633
|
+
}
|
|
50634
|
+
get reason() {
|
|
50635
|
+
return this.#target?.reason ?? null;
|
|
50636
|
+
}
|
|
50637
|
+
get rawHeaders() {
|
|
50638
|
+
return this.#target?.rawHeaders ?? null;
|
|
50639
|
+
}
|
|
50640
|
+
set rawHeaders(value) {
|
|
50641
|
+
if (this.#target) {
|
|
50642
|
+
this.#target.rawHeaders = value;
|
|
50643
|
+
}
|
|
50644
|
+
}
|
|
50645
|
+
get rawTrailers() {
|
|
50646
|
+
return this.#target?.rawTrailers ?? null;
|
|
50647
|
+
}
|
|
50648
|
+
set rawTrailers(value) {
|
|
50649
|
+
if (this.#target) {
|
|
50650
|
+
this.#target.rawTrailers = value;
|
|
50651
|
+
}
|
|
50652
|
+
}
|
|
50653
|
+
};
|
|
50549
50654
|
var RetryHandler = class _RetryHandler {
|
|
50550
50655
|
constructor(opts, { dispatch, handler }) {
|
|
50551
50656
|
const { retryOptions, ...dispatchOpts } = opts;
|
|
@@ -50600,16 +50705,17 @@ var require_retry_handler = __commonJS({
|
|
|
50600
50705
|
this.start = 0;
|
|
50601
50706
|
this.end = null;
|
|
50602
50707
|
this.etag = null;
|
|
50708
|
+
this.controllerProxy = new RetryController();
|
|
50603
50709
|
}
|
|
50604
50710
|
onResponseStartWithRetry(controller, statusCode, headers, statusMessage, err2) {
|
|
50605
50711
|
if (this.retryOpts.throwOnError) {
|
|
50606
50712
|
if (this.retryOpts.statusCodes.includes(statusCode) === false) {
|
|
50607
50713
|
if (this.headersSent) {
|
|
50608
|
-
this.handler.onResponseError?.(
|
|
50714
|
+
this.handler.onResponseError?.(this.controllerProxy, err2);
|
|
50609
50715
|
} else {
|
|
50610
50716
|
this.headersSent = true;
|
|
50611
50717
|
this.checkpointResponseEnd(headers);
|
|
50612
|
-
this.handler.onResponseStart?.(
|
|
50718
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
50613
50719
|
}
|
|
50614
50720
|
} else {
|
|
50615
50721
|
this.error = err2;
|
|
@@ -50619,17 +50725,17 @@ var require_retry_handler = __commonJS({
|
|
|
50619
50725
|
if (isDisturbed(this.opts.body)) {
|
|
50620
50726
|
this.headersSent = true;
|
|
50621
50727
|
this.checkpointResponseEnd(headers);
|
|
50622
|
-
this.handler.onResponseStart?.(
|
|
50728
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
50623
50729
|
return;
|
|
50624
50730
|
}
|
|
50625
50731
|
function shouldRetry(passedErr) {
|
|
50626
50732
|
if (passedErr) {
|
|
50627
50733
|
if (this.headersSent) {
|
|
50628
|
-
this.handler.onResponseError?.(
|
|
50734
|
+
this.handler.onResponseError?.(this.controllerProxy, passedErr);
|
|
50629
50735
|
} else {
|
|
50630
50736
|
this.headersSent = true;
|
|
50631
50737
|
this.checkpointResponseEnd(headers);
|
|
50632
|
-
this.handler.onResponseStart?.(
|
|
50738
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
50633
50739
|
}
|
|
50634
50740
|
controller.resume();
|
|
50635
50741
|
return;
|
|
@@ -50659,12 +50765,13 @@ var require_retry_handler = __commonJS({
|
|
|
50659
50765
|
}
|
|
50660
50766
|
}
|
|
50661
50767
|
onRequestStart(controller, context) {
|
|
50768
|
+
this.controllerProxy.target = controller;
|
|
50662
50769
|
if (!this.headersSent) {
|
|
50663
|
-
this.handler.onRequestStart?.(
|
|
50770
|
+
this.handler.onRequestStart?.(this.controllerProxy, context);
|
|
50664
50771
|
}
|
|
50665
50772
|
}
|
|
50666
|
-
onRequestUpgrade(
|
|
50667
|
-
this.handler.onRequestUpgrade?.(
|
|
50773
|
+
onRequestUpgrade(_controller, statusCode, headers, socket) {
|
|
50774
|
+
this.handler.onRequestUpgrade?.(this.controllerProxy, statusCode, headers, socket);
|
|
50668
50775
|
}
|
|
50669
50776
|
static [kRetryHandlerDefaultRetry](err2, { state, opts }, cb) {
|
|
50670
50777
|
const { statusCode, code: code2, headers } = err2;
|
|
@@ -50752,7 +50859,7 @@ var require_retry_handler = __commonJS({
|
|
|
50752
50859
|
if (range == null) {
|
|
50753
50860
|
this.headersSent = true;
|
|
50754
50861
|
this.handler.onResponseStart?.(
|
|
50755
|
-
|
|
50862
|
+
this.controllerProxy,
|
|
50756
50863
|
statusCode,
|
|
50757
50864
|
headers,
|
|
50758
50865
|
statusMessage
|
|
@@ -50785,7 +50892,7 @@ var require_retry_handler = __commonJS({
|
|
|
50785
50892
|
}
|
|
50786
50893
|
this.headersSent = true;
|
|
50787
50894
|
this.handler.onResponseStart?.(
|
|
50788
|
-
|
|
50895
|
+
this.controllerProxy,
|
|
50789
50896
|
statusCode,
|
|
50790
50897
|
headers,
|
|
50791
50898
|
statusMessage
|
|
@@ -50797,24 +50904,24 @@ var require_retry_handler = __commonJS({
|
|
|
50797
50904
|
});
|
|
50798
50905
|
}
|
|
50799
50906
|
}
|
|
50800
|
-
onResponseData(
|
|
50907
|
+
onResponseData(_controller, chunk2) {
|
|
50801
50908
|
if (this.error) {
|
|
50802
50909
|
return;
|
|
50803
50910
|
}
|
|
50804
50911
|
this.start += chunk2.length;
|
|
50805
|
-
this.handler.onResponseData?.(
|
|
50912
|
+
this.handler.onResponseData?.(this.controllerProxy, chunk2);
|
|
50806
50913
|
}
|
|
50807
|
-
onResponseEnd(
|
|
50914
|
+
onResponseEnd(_controller, trailers) {
|
|
50808
50915
|
if (this.error && this.retryOpts.throwOnError) {
|
|
50809
50916
|
throw this.error;
|
|
50810
50917
|
}
|
|
50811
50918
|
if (!this.error) {
|
|
50812
50919
|
this.retryCount = 0;
|
|
50813
|
-
return this.handler.onResponseEnd?.(
|
|
50920
|
+
return this.handler.onResponseEnd?.(this.controllerProxy, trailers);
|
|
50814
50921
|
}
|
|
50815
|
-
this.retry(
|
|
50922
|
+
this.retry();
|
|
50816
50923
|
}
|
|
50817
|
-
retry(
|
|
50924
|
+
retry() {
|
|
50818
50925
|
if (this.start !== 0) {
|
|
50819
50926
|
const headers = { range: `bytes=${this.start}-${this.end ?? ""}` };
|
|
50820
50927
|
if (this.etag != null) {
|
|
@@ -50832,20 +50939,20 @@ var require_retry_handler = __commonJS({
|
|
|
50832
50939
|
this.retryCountCheckpoint = this.retryCount;
|
|
50833
50940
|
this.dispatch(this.opts, this);
|
|
50834
50941
|
} catch (err2) {
|
|
50835
|
-
this.handler.onResponseError?.(
|
|
50942
|
+
this.handler.onResponseError?.(this.controllerProxy, err2);
|
|
50836
50943
|
}
|
|
50837
50944
|
}
|
|
50838
50945
|
onResponseError(controller, err2) {
|
|
50839
50946
|
if (controller?.aborted || isDisturbed(this.opts.body) || this.headersSent && !this.resume) {
|
|
50840
|
-
this.handler.onResponseError?.(
|
|
50947
|
+
this.handler.onResponseError?.(this.controllerProxy, err2);
|
|
50841
50948
|
return;
|
|
50842
50949
|
}
|
|
50843
50950
|
function shouldRetry(returnedErr) {
|
|
50844
50951
|
if (!returnedErr) {
|
|
50845
|
-
this.retry(
|
|
50952
|
+
this.retry();
|
|
50846
50953
|
return;
|
|
50847
50954
|
}
|
|
50848
|
-
this.handler?.onResponseError?.(
|
|
50955
|
+
this.handler?.onResponseError?.(this.controllerProxy, returnedErr);
|
|
50849
50956
|
}
|
|
50850
50957
|
if (this.retryCount - this.retryCountCheckpoint > 0) {
|
|
50851
50958
|
this.retryCount = this.retryCountCheckpoint + (this.retryCount - this.retryCountCheckpoint);
|
|
@@ -54150,7 +54257,7 @@ var require_redirect_handler = __commonJS({
|
|
|
54150
54257
|
"node_modules/undici/lib/handler/redirect-handler.js"(exports, module) {
|
|
54151
54258
|
"use strict";
|
|
54152
54259
|
var util = require_util();
|
|
54153
|
-
var { kBodyUsed } = require_symbols();
|
|
54260
|
+
var { kBodyUsed, kRedirectCacheControl } = require_symbols();
|
|
54154
54261
|
var assert = __require("assert");
|
|
54155
54262
|
var { InvalidArgumentError } = require_errors();
|
|
54156
54263
|
var EE = __require("events");
|
|
@@ -54188,6 +54295,10 @@ var require_redirect_handler = __commonJS({
|
|
|
54188
54295
|
this.maxRedirections = maxRedirections;
|
|
54189
54296
|
this.handler = handler;
|
|
54190
54297
|
this.history = [];
|
|
54298
|
+
Object.defineProperty(this.history, kRedirectCacheControl, {
|
|
54299
|
+
value: [],
|
|
54300
|
+
enumerable: false
|
|
54301
|
+
});
|
|
54191
54302
|
if (util.isStream(this.opts.body)) {
|
|
54192
54303
|
if (util.bodyLength(this.opts.body) === 0) {
|
|
54193
54304
|
this.opts.body.on("data", function() {
|
|
@@ -54238,6 +54349,7 @@ var require_redirect_handler = __commonJS({
|
|
|
54238
54349
|
this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
|
|
54239
54350
|
return;
|
|
54240
54351
|
}
|
|
54352
|
+
this.history[kRedirectCacheControl].push(headers["cache-control"]);
|
|
54241
54353
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
54242
54354
|
const path99 = search ? `${pathname}${search}` : pathname;
|
|
54243
54355
|
const redirectUrlString = `${origin}${path99}`;
|
|
@@ -55939,6 +56051,7 @@ var require_cache_handler = __commonJS({
|
|
|
55939
56051
|
"node_modules/undici/lib/handler/cache-handler.js"(exports, module) {
|
|
55940
56052
|
"use strict";
|
|
55941
56053
|
var util = require_util();
|
|
56054
|
+
var { kRedirectCacheControl } = require_symbols();
|
|
55942
56055
|
var {
|
|
55943
56056
|
parseCacheControlHeader,
|
|
55944
56057
|
hasInvalidCacheControlDirective,
|
|
@@ -55950,6 +56063,13 @@ var require_cache_handler = __commonJS({
|
|
|
55950
56063
|
var { parseHttpDate } = require_date();
|
|
55951
56064
|
function noop() {
|
|
55952
56065
|
}
|
|
56066
|
+
function sameOrigin(a, b) {
|
|
56067
|
+
try {
|
|
56068
|
+
return new URL(String(a)).origin === new URL(String(b)).origin;
|
|
56069
|
+
} catch {
|
|
56070
|
+
return String(a) === String(b);
|
|
56071
|
+
}
|
|
56072
|
+
}
|
|
55953
56073
|
var HEURISTICALLY_CACHEABLE_STATUS_CODES = [
|
|
55954
56074
|
200,
|
|
55955
56075
|
203,
|
|
@@ -56065,6 +56185,13 @@ var require_cache_handler = __commonJS({
|
|
|
56065
56185
|
* @type {import('node:stream').Writable | undefined}
|
|
56066
56186
|
*/
|
|
56067
56187
|
#writeStream;
|
|
56188
|
+
/**
|
|
56189
|
+
* The URLs visited while following redirects, shared by reference from the
|
|
56190
|
+
* redirect handler through the request context. Carries the suppressed hops'
|
|
56191
|
+
* cache-control under {@link kRedirectCacheControl}.
|
|
56192
|
+
* @type {URL[] | undefined}
|
|
56193
|
+
*/
|
|
56194
|
+
#history;
|
|
56068
56195
|
/**
|
|
56069
56196
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
|
|
56070
56197
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
@@ -56080,6 +56207,7 @@ var require_cache_handler = __commonJS({
|
|
|
56080
56207
|
onRequestStart(controller, context) {
|
|
56081
56208
|
this.#writeStream?.destroy();
|
|
56082
56209
|
this.#writeStream = void 0;
|
|
56210
|
+
this.#history = context?.history;
|
|
56083
56211
|
this.#handler.onRequestStart?.(controller, context);
|
|
56084
56212
|
}
|
|
56085
56213
|
onRequestUpgrade(controller, statusCode, headers, socket) {
|
|
@@ -56103,6 +56231,21 @@ var require_cache_handler = __commonJS({
|
|
|
56103
56231
|
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
|
|
56104
56232
|
return downstreamOnHeaders();
|
|
56105
56233
|
}
|
|
56234
|
+
if (this.#history && this.#history.length > 0) {
|
|
56235
|
+
const finalUrl = this.#history[this.#history.length - 1];
|
|
56236
|
+
if (!sameOrigin(finalUrl.origin, this.#cacheKey.origin)) {
|
|
56237
|
+
return downstreamOnHeaders();
|
|
56238
|
+
}
|
|
56239
|
+
}
|
|
56240
|
+
const redirectCacheControl = this.#history?.[kRedirectCacheControl];
|
|
56241
|
+
if (redirectCacheControl) {
|
|
56242
|
+
for (const hopCacheControl of redirectCacheControl) {
|
|
56243
|
+
const hopDirectives = hopCacheControl ? parseCacheControlHeader(hopCacheControl) : {};
|
|
56244
|
+
if (hopDirectives["no-store"] === true || this.#cacheType === "shared" && hopDirectives.private === true) {
|
|
56245
|
+
return downstreamOnHeaders();
|
|
56246
|
+
}
|
|
56247
|
+
}
|
|
56248
|
+
}
|
|
56106
56249
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
56107
56250
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
56108
56251
|
if (revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives)) {
|
|
@@ -57179,6 +57322,61 @@ var require_decompress = __commonJS({
|
|
|
57179
57322
|
var { InvalidArgumentError, ResponseExceededMaxSizeError } = require_errors();
|
|
57180
57323
|
var DecoratorHandler = require_decorator_handler();
|
|
57181
57324
|
var { runtimeFeatures } = require_runtime_features();
|
|
57325
|
+
var DecompressController = class {
|
|
57326
|
+
#onPause;
|
|
57327
|
+
#onResume;
|
|
57328
|
+
#onAbort;
|
|
57329
|
+
#paused = false;
|
|
57330
|
+
constructor(onPause, onResume, onAbort) {
|
|
57331
|
+
this.#onPause = onPause;
|
|
57332
|
+
this.#onResume = onResume;
|
|
57333
|
+
this.#onAbort = onAbort;
|
|
57334
|
+
this.target = null;
|
|
57335
|
+
}
|
|
57336
|
+
pause() {
|
|
57337
|
+
if (this.#paused) {
|
|
57338
|
+
return;
|
|
57339
|
+
}
|
|
57340
|
+
this.#paused = true;
|
|
57341
|
+
this.#onPause();
|
|
57342
|
+
}
|
|
57343
|
+
resume() {
|
|
57344
|
+
if (!this.#paused) {
|
|
57345
|
+
return;
|
|
57346
|
+
}
|
|
57347
|
+
this.#paused = false;
|
|
57348
|
+
this.#onResume();
|
|
57349
|
+
}
|
|
57350
|
+
abort(reason) {
|
|
57351
|
+
this.target?.abort(reason);
|
|
57352
|
+
this.#onAbort(reason);
|
|
57353
|
+
}
|
|
57354
|
+
get paused() {
|
|
57355
|
+
return this.#paused;
|
|
57356
|
+
}
|
|
57357
|
+
get aborted() {
|
|
57358
|
+
return this.target?.aborted ?? false;
|
|
57359
|
+
}
|
|
57360
|
+
get reason() {
|
|
57361
|
+
return this.target?.reason ?? null;
|
|
57362
|
+
}
|
|
57363
|
+
get rawHeaders() {
|
|
57364
|
+
return this.target?.rawHeaders ?? null;
|
|
57365
|
+
}
|
|
57366
|
+
set rawHeaders(value) {
|
|
57367
|
+
if (this.target) {
|
|
57368
|
+
this.target.rawHeaders = value;
|
|
57369
|
+
}
|
|
57370
|
+
}
|
|
57371
|
+
get rawTrailers() {
|
|
57372
|
+
return this.target?.rawTrailers ?? null;
|
|
57373
|
+
}
|
|
57374
|
+
set rawTrailers(value) {
|
|
57375
|
+
if (this.target) {
|
|
57376
|
+
this.target.rawTrailers = value;
|
|
57377
|
+
}
|
|
57378
|
+
}
|
|
57379
|
+
};
|
|
57182
57380
|
var supportedEncodings = {
|
|
57183
57381
|
gzip: createGunzip,
|
|
57184
57382
|
"x-gzip": createGunzip,
|
|
@@ -57192,7 +57390,7 @@ var require_decompress = __commonJS({
|
|
|
57192
57390
|
/** @type {const} */
|
|
57193
57391
|
[204, 304]
|
|
57194
57392
|
);
|
|
57195
|
-
var defaultMaxSize =
|
|
57393
|
+
var defaultMaxSize = 0;
|
|
57196
57394
|
function createMaxSizeLimiter(maxSize) {
|
|
57197
57395
|
let size = 0;
|
|
57198
57396
|
return new TransformStream2({
|
|
@@ -57230,14 +57428,124 @@ var require_decompress = __commonJS({
|
|
|
57230
57428
|
#terminated = false;
|
|
57231
57429
|
/** @type {boolean} */
|
|
57232
57430
|
#inputEnded = false;
|
|
57431
|
+
/** @type {boolean} */
|
|
57432
|
+
#inputBackpressured = false;
|
|
57433
|
+
/** @type {boolean} */
|
|
57434
|
+
#upstreamPaused = false;
|
|
57435
|
+
/** @type {boolean} */
|
|
57436
|
+
#draining = false;
|
|
57437
|
+
/** @type {boolean} */
|
|
57438
|
+
#drainRequested = false;
|
|
57439
|
+
/** @type {boolean} */
|
|
57440
|
+
#completionPending = false;
|
|
57441
|
+
/** @type {DecompressorStream | undefined} */
|
|
57442
|
+
#finalDecompressor;
|
|
57443
|
+
/** @type {DecompressController} */
|
|
57444
|
+
#controller;
|
|
57233
57445
|
constructor(handler, { skipStatusCodes = defaultSkipStatusCodes, skipErrorResponses = true, maxSize = defaultMaxSize } = {}) {
|
|
57234
|
-
if (!Number.isSafeInteger(maxSize) || maxSize <
|
|
57235
|
-
throw new InvalidArgumentError("maxSize must be a
|
|
57446
|
+
if (!Number.isSafeInteger(maxSize) || maxSize < 0) {
|
|
57447
|
+
throw new InvalidArgumentError("maxSize must be a non-negative integer");
|
|
57236
57448
|
}
|
|
57237
57449
|
super(handler);
|
|
57238
57450
|
this.#skipStatusCodes = skipStatusCodes;
|
|
57239
57451
|
this.#skipErrorResponses = skipErrorResponses;
|
|
57240
57452
|
this.#maxSize = maxSize;
|
|
57453
|
+
this.#controller = new DecompressController(
|
|
57454
|
+
() => this.#onDownstreamPause(),
|
|
57455
|
+
() => this.#onDownstreamResume(),
|
|
57456
|
+
(reason) => {
|
|
57457
|
+
if (this.#inputEnded && !this.#terminated) {
|
|
57458
|
+
this.onResponseError(this.#controller, reason);
|
|
57459
|
+
}
|
|
57460
|
+
}
|
|
57461
|
+
);
|
|
57462
|
+
}
|
|
57463
|
+
#onDownstreamPause() {
|
|
57464
|
+
this.#pauseUpstream();
|
|
57465
|
+
}
|
|
57466
|
+
#onDownstreamResume() {
|
|
57467
|
+
const drainWasDeferred = this.#draining;
|
|
57468
|
+
this.#drainOutput();
|
|
57469
|
+
if (!drainWasDeferred) {
|
|
57470
|
+
this.#resumeUpstreamIfNeeded();
|
|
57471
|
+
this.#finishIfReady();
|
|
57472
|
+
}
|
|
57473
|
+
}
|
|
57474
|
+
#pauseUpstream() {
|
|
57475
|
+
if (!this.#upstreamPaused && !this.#terminated) {
|
|
57476
|
+
this.#upstreamPaused = true;
|
|
57477
|
+
this.#controller.target?.pause();
|
|
57478
|
+
}
|
|
57479
|
+
}
|
|
57480
|
+
#resumeUpstreamIfNeeded() {
|
|
57481
|
+
if (this.#upstreamPaused && !this.#controller.paused && !this.#inputBackpressured) {
|
|
57482
|
+
this.#upstreamPaused = false;
|
|
57483
|
+
if (!this.#inputEnded) {
|
|
57484
|
+
this.#controller.target?.resume();
|
|
57485
|
+
}
|
|
57486
|
+
}
|
|
57487
|
+
}
|
|
57488
|
+
#drainOutput() {
|
|
57489
|
+
if (this.#terminated || this.#controller.paused || !this.#finalDecompressor) {
|
|
57490
|
+
return;
|
|
57491
|
+
}
|
|
57492
|
+
if (this.#draining) {
|
|
57493
|
+
this.#drainRequested = true;
|
|
57494
|
+
return;
|
|
57495
|
+
}
|
|
57496
|
+
this.#draining = true;
|
|
57497
|
+
try {
|
|
57498
|
+
do {
|
|
57499
|
+
this.#drainRequested = false;
|
|
57500
|
+
let chunk2;
|
|
57501
|
+
while (!this.#terminated && !this.#controller.paused && (chunk2 = this.#finalDecompressor.read()) !== null) {
|
|
57502
|
+
if (this.#maxSize > 0) {
|
|
57503
|
+
const decompressedSize = this.#decompressedSize + chunk2.length;
|
|
57504
|
+
if (decompressedSize > this.#maxSize) {
|
|
57505
|
+
this.#fail(new ResponseExceededMaxSizeError(
|
|
57506
|
+
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
57507
|
+
));
|
|
57508
|
+
return;
|
|
57509
|
+
}
|
|
57510
|
+
this.#decompressedSize = decompressedSize;
|
|
57511
|
+
}
|
|
57512
|
+
try {
|
|
57513
|
+
const result = super.onResponseData(this.#controller, chunk2);
|
|
57514
|
+
if (result === false && !this.#controller.paused) {
|
|
57515
|
+
this.#controller.pause();
|
|
57516
|
+
}
|
|
57517
|
+
} catch (err2) {
|
|
57518
|
+
this.#fail(err2);
|
|
57519
|
+
return;
|
|
57520
|
+
}
|
|
57521
|
+
}
|
|
57522
|
+
} while (this.#drainRequested && !this.#terminated && !this.#controller.paused);
|
|
57523
|
+
} finally {
|
|
57524
|
+
this.#draining = false;
|
|
57525
|
+
}
|
|
57526
|
+
this.#resumeUpstreamIfNeeded();
|
|
57527
|
+
this.#finishIfReady();
|
|
57528
|
+
}
|
|
57529
|
+
#finishIfReady() {
|
|
57530
|
+
if (this.#terminated || !this.#completionPending || this.#controller.paused || this.#draining) {
|
|
57531
|
+
return;
|
|
57532
|
+
}
|
|
57533
|
+
this.#cleanupDecompressors();
|
|
57534
|
+
try {
|
|
57535
|
+
super.onResponseEnd(this.#controller, this.#trailers);
|
|
57536
|
+
} catch (err2) {
|
|
57537
|
+
this.#fail(err2);
|
|
57538
|
+
return;
|
|
57539
|
+
}
|
|
57540
|
+
this.#terminated = true;
|
|
57541
|
+
}
|
|
57542
|
+
#onDecompressionEnd() {
|
|
57543
|
+
if (this.#terminated) {
|
|
57544
|
+
return;
|
|
57545
|
+
}
|
|
57546
|
+
this.#completionPending = true;
|
|
57547
|
+
this.#drainOutput();
|
|
57548
|
+
this.#finishIfReady();
|
|
57241
57549
|
}
|
|
57242
57550
|
/**
|
|
57243
57551
|
* Determines if decompression should be skipped based on encoding and status code
|
|
@@ -57280,7 +57588,7 @@ var require_decompress = __commonJS({
|
|
|
57280
57588
|
const streams = [];
|
|
57281
57589
|
for (let i = 0; i < decompressors.length; i++) {
|
|
57282
57590
|
streams.push(decompressors[i]);
|
|
57283
|
-
if (i < decompressors.length - 1) {
|
|
57591
|
+
if (i < decompressors.length - 1 && this.#maxSize > 0) {
|
|
57284
57592
|
streams.push(createMaxSizeLimiter(this.#maxSize));
|
|
57285
57593
|
}
|
|
57286
57594
|
}
|
|
@@ -57288,87 +57596,67 @@ var require_decompress = __commonJS({
|
|
|
57288
57596
|
}
|
|
57289
57597
|
/**
|
|
57290
57598
|
* Stops decompression and reports an error.
|
|
57291
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
57292
57599
|
* @param {Error} error - The decompression error
|
|
57293
57600
|
* @returns {void}
|
|
57294
57601
|
*/
|
|
57295
|
-
#fail(
|
|
57602
|
+
#fail(error) {
|
|
57296
57603
|
if (this.#terminated) {
|
|
57297
57604
|
return;
|
|
57298
57605
|
}
|
|
57299
57606
|
if (this.#inputEnded) {
|
|
57300
|
-
this.onResponseError(controller, error);
|
|
57607
|
+
this.onResponseError(this.#controller, error);
|
|
57301
57608
|
} else {
|
|
57302
|
-
controller.abort(error);
|
|
57609
|
+
this.#controller.abort(error);
|
|
57303
57610
|
}
|
|
57304
57611
|
}
|
|
57305
57612
|
/**
|
|
57306
|
-
* Sets up event handlers for
|
|
57613
|
+
* Sets up event handlers for the final decompressor stream.
|
|
57307
57614
|
* @param {DecompressorStream} decompressor - The decompressor stream
|
|
57308
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
57309
57615
|
* @returns {void}
|
|
57310
57616
|
*/
|
|
57311
|
-
#setupDecompressorEvents(decompressor
|
|
57312
|
-
|
|
57313
|
-
|
|
57314
|
-
|
|
57315
|
-
}
|
|
57316
|
-
let chunk2;
|
|
57317
|
-
while ((chunk2 = decompressor.read()) !== null) {
|
|
57318
|
-
const decompressedSize = this.#decompressedSize + chunk2.length;
|
|
57319
|
-
if (decompressedSize > this.#maxSize) {
|
|
57320
|
-
this.#fail(controller, new ResponseExceededMaxSizeError(
|
|
57321
|
-
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
57322
|
-
));
|
|
57323
|
-
return;
|
|
57324
|
-
}
|
|
57325
|
-
this.#decompressedSize = decompressedSize;
|
|
57326
|
-
const result = super.onResponseData(controller, chunk2);
|
|
57327
|
-
if (result === false) {
|
|
57328
|
-
break;
|
|
57329
|
-
}
|
|
57330
|
-
}
|
|
57331
|
-
});
|
|
57332
|
-
decompressor.on("error", (error) => {
|
|
57333
|
-
this.#fail(controller, error);
|
|
57334
|
-
});
|
|
57617
|
+
#setupDecompressorEvents(decompressor) {
|
|
57618
|
+
this.#finalDecompressor = decompressor;
|
|
57619
|
+
decompressor.on("readable", () => this.#drainOutput());
|
|
57620
|
+
decompressor.on("error", (error) => this.#fail(error));
|
|
57335
57621
|
}
|
|
57336
57622
|
/**
|
|
57337
57623
|
* Sets up event handling for a single decompressor
|
|
57338
|
-
* @param {Controller} controller - The controller to handle events
|
|
57339
57624
|
* @returns {void}
|
|
57340
57625
|
*/
|
|
57341
|
-
#setupSingleDecompressor(
|
|
57626
|
+
#setupSingleDecompressor() {
|
|
57342
57627
|
const decompressor = this.#decompressors[0];
|
|
57343
|
-
this.#setupDecompressorEvents(decompressor
|
|
57344
|
-
decompressor.on("end", () =>
|
|
57345
|
-
if (this.#terminated) {
|
|
57346
|
-
return;
|
|
57347
|
-
}
|
|
57348
|
-
this.#terminated = true;
|
|
57349
|
-
this.#cleanupDecompressors();
|
|
57350
|
-
super.onResponseEnd(controller, this.#trailers);
|
|
57351
|
-
});
|
|
57628
|
+
this.#setupDecompressorEvents(decompressor);
|
|
57629
|
+
decompressor.on("end", () => this.#onDecompressionEnd());
|
|
57352
57630
|
}
|
|
57353
57631
|
/**
|
|
57354
57632
|
* Sets up event handling for multiple chained decompressors using pipeline
|
|
57355
|
-
* @param {Controller} controller - The controller to handle events
|
|
57356
57633
|
* @returns {void}
|
|
57357
57634
|
*/
|
|
57358
|
-
#setupMultipleDecompressors(
|
|
57635
|
+
#setupMultipleDecompressors() {
|
|
57359
57636
|
const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
|
|
57360
|
-
this.#setupDecompressorEvents(lastDecompressor
|
|
57637
|
+
this.#setupDecompressorEvents(lastDecompressor);
|
|
57361
57638
|
pipeline2(this.#decompressors, (err2) => {
|
|
57362
57639
|
if (this.#terminated) {
|
|
57363
57640
|
return;
|
|
57364
57641
|
}
|
|
57365
57642
|
if (err2) {
|
|
57366
|
-
this.#fail(
|
|
57643
|
+
this.#fail(err2);
|
|
57367
57644
|
return;
|
|
57368
57645
|
}
|
|
57369
|
-
this.#
|
|
57370
|
-
|
|
57371
|
-
|
|
57646
|
+
this.#onDecompressionEnd();
|
|
57647
|
+
});
|
|
57648
|
+
}
|
|
57649
|
+
#setupInputBackpressure() {
|
|
57650
|
+
const decompressor = this.#decompressors[0];
|
|
57651
|
+
decompressor.on("drain", () => {
|
|
57652
|
+
if (this.#terminated) {
|
|
57653
|
+
return;
|
|
57654
|
+
}
|
|
57655
|
+
this.#inputBackpressured = false;
|
|
57656
|
+
if (!this.#controller.paused) {
|
|
57657
|
+
this.#drainOutput();
|
|
57658
|
+
this.#resumeUpstreamIfNeeded();
|
|
57659
|
+
}
|
|
57372
57660
|
});
|
|
57373
57661
|
}
|
|
57374
57662
|
/**
|
|
@@ -57377,6 +57665,14 @@ var require_decompress = __commonJS({
|
|
|
57377
57665
|
*/
|
|
57378
57666
|
#cleanupDecompressors() {
|
|
57379
57667
|
this.#decompressors.length = 0;
|
|
57668
|
+
this.#finalDecompressor = void 0;
|
|
57669
|
+
}
|
|
57670
|
+
onRequestStart(controller, context) {
|
|
57671
|
+
this.#controller.target = controller;
|
|
57672
|
+
return super.onRequestStart(this.#controller, context);
|
|
57673
|
+
}
|
|
57674
|
+
onRequestUpgrade(controller, statusCode, headers, socket) {
|
|
57675
|
+
return super.onRequestUpgrade(this.#controller, statusCode, headers, socket);
|
|
57380
57676
|
}
|
|
57381
57677
|
/**
|
|
57382
57678
|
* @param {Controller} controller
|
|
@@ -57388,17 +57684,17 @@ var require_decompress = __commonJS({
|
|
|
57388
57684
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
57389
57685
|
const contentEncoding = headers["content-encoding"];
|
|
57390
57686
|
if (this.#shouldSkipDecompression(contentEncoding, statusCode)) {
|
|
57391
|
-
return super.onResponseStart(controller, statusCode, headers, statusMessage);
|
|
57687
|
+
return super.onResponseStart(this.#controller, statusCode, headers, statusMessage);
|
|
57392
57688
|
}
|
|
57393
57689
|
const decompressors = this.#createDecompressionChain(contentEncoding.toLowerCase());
|
|
57394
57690
|
if (decompressors.length === 0) {
|
|
57395
57691
|
this.#cleanupDecompressors();
|
|
57396
|
-
return super.onResponseStart(controller, statusCode, headers, statusMessage);
|
|
57692
|
+
return super.onResponseStart(this.#controller, statusCode, headers, statusMessage);
|
|
57397
57693
|
}
|
|
57398
57694
|
this.#decompressors = decompressors;
|
|
57399
57695
|
const { "content-encoding": _, "content-length": __, ...newHeaders } = headers;
|
|
57400
|
-
if (controller
|
|
57401
|
-
const rawHeaders = controller.rawHeaders;
|
|
57696
|
+
if (this.#controller.rawHeaders) {
|
|
57697
|
+
const rawHeaders = this.#controller.rawHeaders;
|
|
57402
57698
|
if (Array.isArray(rawHeaders)) {
|
|
57403
57699
|
const filteredHeaders = [];
|
|
57404
57700
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
@@ -57420,12 +57716,13 @@ var require_decompress = __commonJS({
|
|
|
57420
57716
|
}
|
|
57421
57717
|
}
|
|
57422
57718
|
}
|
|
57719
|
+
this.#setupInputBackpressure();
|
|
57423
57720
|
if (this.#decompressors.length === 1) {
|
|
57424
|
-
this.#setupSingleDecompressor(
|
|
57721
|
+
this.#setupSingleDecompressor();
|
|
57425
57722
|
} else {
|
|
57426
|
-
this.#setupMultipleDecompressors(
|
|
57723
|
+
this.#setupMultipleDecompressors();
|
|
57427
57724
|
}
|
|
57428
|
-
return super.onResponseStart(controller, statusCode, newHeaders, statusMessage);
|
|
57725
|
+
return super.onResponseStart(this.#controller, statusCode, newHeaders, statusMessage);
|
|
57429
57726
|
}
|
|
57430
57727
|
/**
|
|
57431
57728
|
* @param {Controller} controller
|
|
@@ -57434,10 +57731,13 @@ var require_decompress = __commonJS({
|
|
|
57434
57731
|
*/
|
|
57435
57732
|
onResponseData(controller, chunk2) {
|
|
57436
57733
|
if (this.#decompressors.length > 0) {
|
|
57437
|
-
this.#decompressors[0].write(chunk2)
|
|
57734
|
+
if (!this.#decompressors[0].write(chunk2)) {
|
|
57735
|
+
this.#inputBackpressured = true;
|
|
57736
|
+
this.#pauseUpstream();
|
|
57737
|
+
}
|
|
57438
57738
|
return;
|
|
57439
57739
|
}
|
|
57440
|
-
super.onResponseData(controller, chunk2);
|
|
57740
|
+
return super.onResponseData(this.#controller, chunk2);
|
|
57441
57741
|
}
|
|
57442
57742
|
/**
|
|
57443
57743
|
* @param {Controller} controller
|
|
@@ -57451,7 +57751,7 @@ var require_decompress = __commonJS({
|
|
|
57451
57751
|
this.#decompressors[0].end();
|
|
57452
57752
|
return;
|
|
57453
57753
|
}
|
|
57454
|
-
super.onResponseEnd(controller, trailers);
|
|
57754
|
+
return super.onResponseEnd(this.#controller, trailers);
|
|
57455
57755
|
}
|
|
57456
57756
|
/**
|
|
57457
57757
|
* @param {Controller} controller
|
|
@@ -57467,7 +57767,7 @@ var require_decompress = __commonJS({
|
|
|
57467
57767
|
decompressor.destroy();
|
|
57468
57768
|
}
|
|
57469
57769
|
this.#cleanupDecompressors();
|
|
57470
|
-
super.onResponseError(controller, err2);
|
|
57770
|
+
super.onResponseError(this.#controller, err2);
|
|
57471
57771
|
}
|
|
57472
57772
|
};
|
|
57473
57773
|
function createDecompressInterceptor(options = {}) {
|
|
@@ -57500,6 +57800,18 @@ var require_deduplication_handler = __commonJS({
|
|
|
57500
57800
|
* @type {DispatchHandler}
|
|
57501
57801
|
*/
|
|
57502
57802
|
#primaryHandler;
|
|
57803
|
+
/**
|
|
57804
|
+
* Whether the primary request has started (onRequestStart received). Until
|
|
57805
|
+
* then the request context is unknown and cannot be given to waiting handlers.
|
|
57806
|
+
* @type {boolean}
|
|
57807
|
+
*/
|
|
57808
|
+
#requestStarted = false;
|
|
57809
|
+
/**
|
|
57810
|
+
* The primary request context, replayed to waiting handlers so they observe
|
|
57811
|
+
* the same redirect history as the primary.
|
|
57812
|
+
* @type {any}
|
|
57813
|
+
*/
|
|
57814
|
+
#context = null;
|
|
57503
57815
|
/**
|
|
57504
57816
|
* @type {WaitingHandler[]}
|
|
57505
57817
|
*/
|
|
@@ -57568,18 +57880,22 @@ var require_deduplication_handler = __commonJS({
|
|
|
57568
57880
|
const waitingHandler = this.#createWaitingHandler(handler);
|
|
57569
57881
|
const waitingController = waitingHandler.controller;
|
|
57570
57882
|
try {
|
|
57571
|
-
|
|
57572
|
-
|
|
57573
|
-
|
|
57574
|
-
|
|
57575
|
-
|
|
57576
|
-
|
|
57577
|
-
|
|
57578
|
-
|
|
57579
|
-
|
|
57580
|
-
|
|
57581
|
-
|
|
57582
|
-
|
|
57883
|
+
if (this.#requestStarted) {
|
|
57884
|
+
handler.onRequestStart?.(waitingController, this.#context);
|
|
57885
|
+
if (waitingController.aborted) {
|
|
57886
|
+
waitingHandler.done = true;
|
|
57887
|
+
return true;
|
|
57888
|
+
}
|
|
57889
|
+
if (this.#responseStarted) {
|
|
57890
|
+
handler.onResponseStart?.(
|
|
57891
|
+
waitingController,
|
|
57892
|
+
this.#statusCode,
|
|
57893
|
+
this.#headers,
|
|
57894
|
+
this.#statusMessage
|
|
57895
|
+
);
|
|
57896
|
+
}
|
|
57897
|
+
} else {
|
|
57898
|
+
waitingHandler.pendingStart = true;
|
|
57583
57899
|
}
|
|
57584
57900
|
} catch {
|
|
57585
57901
|
waitingHandler.done = true;
|
|
@@ -57596,6 +57912,21 @@ var require_deduplication_handler = __commonJS({
|
|
|
57596
57912
|
*/
|
|
57597
57913
|
onRequestStart(controller, context) {
|
|
57598
57914
|
this.#controller = controller;
|
|
57915
|
+
if (!this.#requestStarted) {
|
|
57916
|
+
this.#requestStarted = true;
|
|
57917
|
+
this.#context = context;
|
|
57918
|
+
for (const waitingHandler of this.#waitingHandlers) {
|
|
57919
|
+
if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
|
|
57920
|
+
waitingHandler.pendingStart = false;
|
|
57921
|
+
try {
|
|
57922
|
+
waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context);
|
|
57923
|
+
} catch {
|
|
57924
|
+
waitingHandler.done = true;
|
|
57925
|
+
}
|
|
57926
|
+
}
|
|
57927
|
+
}
|
|
57928
|
+
this.#pruneDoneWaitingHandlers();
|
|
57929
|
+
}
|
|
57599
57930
|
this.#primaryHandler.onRequestStart?.(controller, context);
|
|
57600
57931
|
}
|
|
57601
57932
|
/**
|
|
@@ -57733,7 +58064,8 @@ var require_deduplication_handler = __commonJS({
|
|
|
57733
58064
|
bufferedChunks: [],
|
|
57734
58065
|
bufferedBytes: 0,
|
|
57735
58066
|
pendingTrailers: null,
|
|
57736
|
-
done: false
|
|
58067
|
+
done: false,
|
|
58068
|
+
pendingStart: false
|
|
57737
58069
|
};
|
|
57738
58070
|
const state = {
|
|
57739
58071
|
aborted: false,
|
|
@@ -59942,6 +60274,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
59942
60274
|
"use strict";
|
|
59943
60275
|
var assert = __require("assert");
|
|
59944
60276
|
var { runtimeFeatures } = require_runtime_features();
|
|
60277
|
+
var { asciiLowercase } = require_infra();
|
|
59945
60278
|
var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
|
|
59946
60279
|
var crypto12;
|
|
59947
60280
|
if (runtimeFeatures.has("crypto")) {
|
|
@@ -59964,10 +60297,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
59964
60297
|
validSRIHashAlgorithmTokenSet
|
|
59965
60298
|
)
|
|
59966
60299
|
);
|
|
59967
|
-
var isValidSRIHashAlgorithm = (
|
|
59968
|
-
/** @type {IsValidSRIHashAlgorithm} */
|
|
59969
|
-
Map.prototype.has.bind(validSRIHashAlgorithmTokenSet)
|
|
59970
|
-
);
|
|
60300
|
+
var isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
|
|
59971
60301
|
var bytesMatch = runtimeFeatures.has("crypto") === false || validSRIHashAlgorithmTokenSet.size === 0 ? () => true : (bytes, metadataList) => {
|
|
59972
60302
|
const parsedMetadata = parseMetadata(metadataList);
|
|
59973
60303
|
if (parsedMetadata.length === 0) {
|
|
@@ -60028,7 +60358,8 @@ var require_subresource_integrity = __commonJS({
|
|
|
60028
60358
|
base64Value = algorithmAndValue[1];
|
|
60029
60359
|
}
|
|
60030
60360
|
const metadata2 = {
|
|
60031
|
-
|
|
60361
|
+
// Possible spec bug?
|
|
60362
|
+
alg: asciiLowercase(algorithm),
|
|
60032
60363
|
val: base64Value
|
|
60033
60364
|
};
|
|
60034
60365
|
result.push(metadata2);
|
|
@@ -61077,7 +61408,6 @@ var require_fetch = __commonJS({
|
|
|
61077
61408
|
}
|
|
61078
61409
|
}
|
|
61079
61410
|
const location = headersList.get("location", true);
|
|
61080
|
-
this.body = new Readable2({ read: resume });
|
|
61081
61411
|
const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status);
|
|
61082
61412
|
const decoders = [];
|
|
61083
61413
|
if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
|
|
@@ -61085,7 +61415,7 @@ var require_fetch = __commonJS({
|
|
|
61085
61415
|
const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : [];
|
|
61086
61416
|
const maxContentEncodings = 5;
|
|
61087
61417
|
if (codings.length > maxContentEncodings) {
|
|
61088
|
-
|
|
61418
|
+
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
|
|
61089
61419
|
return true;
|
|
61090
61420
|
}
|
|
61091
61421
|
for (let i = codings.length - 1; i >= 0; --i) {
|
|
@@ -61120,6 +61450,7 @@ var require_fetch = __commonJS({
|
|
|
61120
61450
|
}
|
|
61121
61451
|
}
|
|
61122
61452
|
}
|
|
61453
|
+
this.body = new Readable2({ read: resume });
|
|
61123
61454
|
const onError = this.onError.bind(this);
|
|
61124
61455
|
resolve2({
|
|
61125
61456
|
status,
|
|
@@ -62099,8 +62430,12 @@ var require_util4 = __commonJS({
|
|
|
62099
62430
|
validateCookiePath(cookie.path);
|
|
62100
62431
|
out.push(`Path=${cookie.path}`);
|
|
62101
62432
|
}
|
|
62102
|
-
if (cookie.expires
|
|
62103
|
-
|
|
62433
|
+
if (cookie.expires != null) {
|
|
62434
|
+
const expiresMs = cookie.expires instanceof Date ? cookie.expires.getTime() : cookie.expires;
|
|
62435
|
+
const maxTimeValue = 864e13;
|
|
62436
|
+
if (typeof expiresMs === "number" && Number.isFinite(expiresMs) && Math.abs(expiresMs) <= maxTimeValue) {
|
|
62437
|
+
out.push(`Expires=${toIMFDate(cookie.expires)}`);
|
|
62438
|
+
}
|
|
62104
62439
|
}
|
|
62105
62440
|
if (cookie.sameSite) {
|
|
62106
62441
|
out.push(`SameSite=${cookie.sameSite}`);
|
|
@@ -62175,88 +62510,89 @@ var require_parse = __commonJS({
|
|
|
62175
62510
|
};
|
|
62176
62511
|
}
|
|
62177
62512
|
function parseUnparsedAttributes(unparsedAttributes, cookieAttributeList = {}) {
|
|
62178
|
-
|
|
62179
|
-
|
|
62180
|
-
|
|
62181
|
-
|
|
62182
|
-
|
|
62183
|
-
|
|
62184
|
-
|
|
62185
|
-
|
|
62186
|
-
|
|
62187
|
-
|
|
62188
|
-
|
|
62189
|
-
|
|
62190
|
-
|
|
62191
|
-
|
|
62192
|
-
|
|
62193
|
-
|
|
62194
|
-
|
|
62195
|
-
|
|
62196
|
-
|
|
62197
|
-
|
|
62198
|
-
|
|
62199
|
-
|
|
62200
|
-
|
|
62201
|
-
|
|
62202
|
-
|
|
62203
|
-
|
|
62204
|
-
|
|
62205
|
-
|
|
62206
|
-
attributeName = cookieAv;
|
|
62207
|
-
}
|
|
62208
|
-
attributeName = attributeName.trim();
|
|
62209
|
-
attributeValue = attributeValue.trim();
|
|
62210
|
-
if (attributeValue.length > maxAttributeValueSize) {
|
|
62211
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62212
|
-
}
|
|
62213
|
-
const attributeNameLowercase = attributeName.toLowerCase();
|
|
62214
|
-
if (attributeNameLowercase === "expires") {
|
|
62215
|
-
const expiryTime = new Date(attributeValue);
|
|
62216
|
-
cookieAttributeList.expires = expiryTime;
|
|
62217
|
-
} else if (attributeNameLowercase === "max-age") {
|
|
62218
|
-
const charCode = attributeValue.charCodeAt(0);
|
|
62219
|
-
if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") {
|
|
62220
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62221
|
-
}
|
|
62222
|
-
if (!/^\d+$/.test(attributeValue)) {
|
|
62223
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62224
|
-
}
|
|
62225
|
-
const deltaSeconds = Number(attributeValue);
|
|
62226
|
-
cookieAttributeList.maxAge = deltaSeconds;
|
|
62227
|
-
} else if (attributeNameLowercase === "domain") {
|
|
62228
|
-
let cookieDomain = attributeValue;
|
|
62229
|
-
if (cookieDomain[0] === ".") {
|
|
62230
|
-
cookieDomain = cookieDomain.slice(1);
|
|
62231
|
-
}
|
|
62232
|
-
cookieDomain = cookieDomain.toLowerCase();
|
|
62233
|
-
cookieAttributeList.domain = cookieDomain;
|
|
62234
|
-
} else if (attributeNameLowercase === "path") {
|
|
62235
|
-
let cookiePath = "";
|
|
62236
|
-
if (attributeValue.length === 0 || attributeValue[0] !== "/") {
|
|
62237
|
-
cookiePath = "/";
|
|
62513
|
+
while (true) {
|
|
62514
|
+
if (unparsedAttributes.length === 0) {
|
|
62515
|
+
return cookieAttributeList;
|
|
62516
|
+
}
|
|
62517
|
+
assert(unparsedAttributes[0] === ";");
|
|
62518
|
+
unparsedAttributes = unparsedAttributes.slice(1);
|
|
62519
|
+
let cookieAv = "";
|
|
62520
|
+
if (unparsedAttributes.includes(";")) {
|
|
62521
|
+
cookieAv = collectASequenceOfCodePointsFast(
|
|
62522
|
+
";",
|
|
62523
|
+
unparsedAttributes,
|
|
62524
|
+
{ position: 0 }
|
|
62525
|
+
);
|
|
62526
|
+
unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
|
|
62527
|
+
} else {
|
|
62528
|
+
cookieAv = unparsedAttributes;
|
|
62529
|
+
unparsedAttributes = "";
|
|
62530
|
+
}
|
|
62531
|
+
let attributeName = "";
|
|
62532
|
+
let attributeValue = "";
|
|
62533
|
+
if (cookieAv.includes("=")) {
|
|
62534
|
+
const position = { position: 0 };
|
|
62535
|
+
attributeName = collectASequenceOfCodePointsFast(
|
|
62536
|
+
"=",
|
|
62537
|
+
cookieAv,
|
|
62538
|
+
position
|
|
62539
|
+
);
|
|
62540
|
+
attributeValue = cookieAv.slice(position.position + 1);
|
|
62238
62541
|
} else {
|
|
62239
|
-
|
|
62240
|
-
}
|
|
62241
|
-
|
|
62242
|
-
|
|
62243
|
-
|
|
62244
|
-
|
|
62245
|
-
|
|
62246
|
-
|
|
62247
|
-
|
|
62248
|
-
|
|
62249
|
-
cookieAttributeList.
|
|
62250
|
-
} else if (
|
|
62251
|
-
|
|
62252
|
-
|
|
62253
|
-
|
|
62542
|
+
attributeName = cookieAv;
|
|
62543
|
+
}
|
|
62544
|
+
attributeName = attributeName.trim();
|
|
62545
|
+
attributeValue = attributeValue.trim();
|
|
62546
|
+
if (attributeValue.length > maxAttributeValueSize) {
|
|
62547
|
+
continue;
|
|
62548
|
+
}
|
|
62549
|
+
const attributeNameLowercase = attributeName.toLowerCase();
|
|
62550
|
+
if (attributeNameLowercase === "expires") {
|
|
62551
|
+
const expiryTime = new Date(attributeValue);
|
|
62552
|
+
cookieAttributeList.expires = expiryTime;
|
|
62553
|
+
} else if (attributeNameLowercase === "max-age") {
|
|
62554
|
+
const charCode = attributeValue.charCodeAt(0);
|
|
62555
|
+
if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") {
|
|
62556
|
+
continue;
|
|
62557
|
+
}
|
|
62558
|
+
if (!/^\d+$/.test(attributeValue)) {
|
|
62559
|
+
continue;
|
|
62560
|
+
}
|
|
62561
|
+
const deltaSeconds = Number(attributeValue);
|
|
62562
|
+
cookieAttributeList.maxAge = deltaSeconds;
|
|
62563
|
+
} else if (attributeNameLowercase === "domain") {
|
|
62564
|
+
let cookieDomain = attributeValue;
|
|
62565
|
+
if (cookieDomain[0] === ".") {
|
|
62566
|
+
cookieDomain = cookieDomain.slice(1);
|
|
62567
|
+
}
|
|
62568
|
+
cookieDomain = cookieDomain.toLowerCase();
|
|
62569
|
+
cookieAttributeList.domain = cookieDomain;
|
|
62570
|
+
} else if (attributeNameLowercase === "path") {
|
|
62571
|
+
let cookiePath = "";
|
|
62572
|
+
if (attributeValue.length === 0 || attributeValue[0] !== "/") {
|
|
62573
|
+
cookiePath = "/";
|
|
62574
|
+
} else {
|
|
62575
|
+
cookiePath = attributeValue;
|
|
62576
|
+
}
|
|
62577
|
+
cookieAttributeList.path = cookiePath;
|
|
62578
|
+
} else if (attributeNameLowercase === "secure") {
|
|
62579
|
+
cookieAttributeList.secure = true;
|
|
62580
|
+
} else if (attributeNameLowercase === "httponly") {
|
|
62581
|
+
cookieAttributeList.httpOnly = true;
|
|
62582
|
+
} else if (attributeNameLowercase === "samesite") {
|
|
62583
|
+
const attributeValueLowercase = attributeValue.toLowerCase();
|
|
62584
|
+
if (attributeValueLowercase === "none") {
|
|
62585
|
+
cookieAttributeList.sameSite = "None";
|
|
62586
|
+
} else if (attributeValueLowercase === "strict") {
|
|
62587
|
+
cookieAttributeList.sameSite = "Strict";
|
|
62588
|
+
} else if (attributeValueLowercase === "lax") {
|
|
62589
|
+
cookieAttributeList.sameSite = "Lax";
|
|
62590
|
+
}
|
|
62591
|
+
} else {
|
|
62592
|
+
cookieAttributeList.unparsed ??= [];
|
|
62593
|
+
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
|
|
62254
62594
|
}
|
|
62255
|
-
} else {
|
|
62256
|
-
cookieAttributeList.unparsed ??= [];
|
|
62257
|
-
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
|
|
62258
62595
|
}
|
|
62259
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62260
62596
|
}
|
|
62261
62597
|
module.exports = {
|
|
62262
62598
|
parseSetCookie,
|
|
@@ -62278,7 +62614,7 @@ var require_cookies = __commonJS({
|
|
|
62278
62614
|
webidl.argumentLengthCheck(arguments, 1, "getCookies");
|
|
62279
62615
|
brandChecks(headers);
|
|
62280
62616
|
const cookie = headers.get("cookie");
|
|
62281
|
-
const out = {};
|
|
62617
|
+
const out = { __proto__: null };
|
|
62282
62618
|
if (!cookie) {
|
|
62283
62619
|
return out;
|
|
62284
62620
|
}
|
|
@@ -63054,11 +63390,11 @@ var require_connection = __commonJS({
|
|
|
63054
63390
|
processResponse(response) {
|
|
63055
63391
|
if (response.type === "error" || response.status !== 101) {
|
|
63056
63392
|
if (response.socket?.session == null) {
|
|
63057
|
-
|
|
63393
|
+
failHandshake(handler, response, 1002, "Received network error or non-101 status code.", response.error);
|
|
63058
63394
|
return;
|
|
63059
63395
|
}
|
|
63060
63396
|
if (response.status !== 200) {
|
|
63061
|
-
|
|
63397
|
+
failHandshake(handler, response, 1002, "Received network error or non-200 status code.", response.error);
|
|
63062
63398
|
return;
|
|
63063
63399
|
}
|
|
63064
63400
|
}
|
|
@@ -63067,21 +63403,21 @@ var require_connection = __commonJS({
|
|
|
63067
63403
|
warningEmitted = true;
|
|
63068
63404
|
}
|
|
63069
63405
|
if (protocols.length !== 0 && !response.headersList.get("Sec-WebSocket-Protocol")) {
|
|
63070
|
-
|
|
63406
|
+
failHandshake(handler, response, 1002, "Server did not respond with sent protocols.");
|
|
63071
63407
|
return;
|
|
63072
63408
|
}
|
|
63073
63409
|
if (response.socket.session == null && response.headersList.get("Upgrade")?.toLowerCase() !== "websocket") {
|
|
63074
|
-
|
|
63410
|
+
failHandshake(handler, response, 1002, 'Server did not set Upgrade header to "websocket".');
|
|
63075
63411
|
return;
|
|
63076
63412
|
}
|
|
63077
63413
|
if (response.socket.session == null && response.headersList.get("Connection")?.toLowerCase() !== "upgrade") {
|
|
63078
|
-
|
|
63414
|
+
failHandshake(handler, response, 1002, 'Server did not set Connection header to "upgrade".');
|
|
63079
63415
|
return;
|
|
63080
63416
|
}
|
|
63081
63417
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
63082
63418
|
const digest = crypto12.hash("sha1", keyValue + uid, "base64");
|
|
63083
63419
|
if (secWSAccept !== digest) {
|
|
63084
|
-
|
|
63420
|
+
failHandshake(handler, response, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
63085
63421
|
return;
|
|
63086
63422
|
}
|
|
63087
63423
|
const secExtension = response.headersList.get("Sec-WebSocket-Extensions");
|
|
@@ -63089,7 +63425,7 @@ var require_connection = __commonJS({
|
|
|
63089
63425
|
if (secExtension !== null) {
|
|
63090
63426
|
extensions = parseExtensions(secExtension);
|
|
63091
63427
|
if (!extensions.has("permessage-deflate")) {
|
|
63092
|
-
|
|
63428
|
+
failHandshake(handler, response, 1002, "Sec-WebSocket-Extensions header does not match.");
|
|
63093
63429
|
return;
|
|
63094
63430
|
}
|
|
63095
63431
|
}
|
|
@@ -63097,7 +63433,7 @@ var require_connection = __commonJS({
|
|
|
63097
63433
|
if (secProtocol !== null) {
|
|
63098
63434
|
const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList);
|
|
63099
63435
|
if (requestProtocols === null || !requestProtocols.includes(secProtocol)) {
|
|
63100
|
-
|
|
63436
|
+
failHandshake(handler, response, 1002, "Protocol was not set in the opening handshake.");
|
|
63101
63437
|
return;
|
|
63102
63438
|
}
|
|
63103
63439
|
}
|
|
@@ -63143,6 +63479,12 @@ var require_connection = __commonJS({
|
|
|
63143
63479
|
object.readyState = states.CLOSING;
|
|
63144
63480
|
}
|
|
63145
63481
|
}
|
|
63482
|
+
function failHandshake(handler, response, code2, reason, cause) {
|
|
63483
|
+
if (response.socket?.session != null && !response.socket.destroyed) {
|
|
63484
|
+
response.socket.destroy();
|
|
63485
|
+
}
|
|
63486
|
+
failWebsocketConnection(handler, code2, reason, cause);
|
|
63487
|
+
}
|
|
63146
63488
|
function failWebsocketConnection(handler, code2, reason, cause) {
|
|
63147
63489
|
if (isEstablished(handler.readyState)) {
|
|
63148
63490
|
closeWebSocketConnection(handler, code2, reason, false);
|
|
@@ -63421,6 +63763,15 @@ var require_receiver = __commonJS({
|
|
|
63421
63763
|
if (isControlFrame(this.#info.opcode)) {
|
|
63422
63764
|
this.#loop = this.parseControlFrame(body);
|
|
63423
63765
|
this.#state = parserStates.INFO;
|
|
63766
|
+
if (this.#loop && this.#handler.socket.writableNeedDrain) {
|
|
63767
|
+
this.#loop = false;
|
|
63768
|
+
this.#handler.socket.once("drain", () => {
|
|
63769
|
+
if (this.destroyed) return;
|
|
63770
|
+
this.#loop = true;
|
|
63771
|
+
this.run(callback);
|
|
63772
|
+
});
|
|
63773
|
+
return;
|
|
63774
|
+
}
|
|
63424
63775
|
} else {
|
|
63425
63776
|
if (!this.#info.compressed) {
|
|
63426
63777
|
if (!this.writeFragments(body)) {
|
|
@@ -64596,6 +64947,7 @@ var require_util6 = __commonJS({
|
|
|
64596
64947
|
var require_eventsource_stream = __commonJS({
|
|
64597
64948
|
"node_modules/undici/lib/web/eventsource/eventsource-stream.js"(exports, module) {
|
|
64598
64949
|
"use strict";
|
|
64950
|
+
var buffer = __require("buffer");
|
|
64599
64951
|
var { Transform } = __require("stream");
|
|
64600
64952
|
var { isASCIINumber, isValidLastEventId } = require_util6();
|
|
64601
64953
|
var BOM = [239, 187, 191];
|
|
@@ -64603,24 +64955,28 @@ var require_eventsource_stream = __commonJS({
|
|
|
64603
64955
|
var CR = 13;
|
|
64604
64956
|
var COLON = 58;
|
|
64605
64957
|
var SPACE = 32;
|
|
64958
|
+
var defaultMaxEventSize = buffer.kStringMaxLength;
|
|
64606
64959
|
var DATA = Buffer.from("data");
|
|
64607
64960
|
var EVENT = Buffer.from("event");
|
|
64608
64961
|
var ID = Buffer.from("id");
|
|
64609
64962
|
var RETRY = Buffer.from("retry");
|
|
64610
|
-
|
|
64611
|
-
|
|
64963
|
+
var minParserItems = 1024;
|
|
64964
|
+
var maxParserItems = 131072;
|
|
64965
|
+
var bytesPerParserItem = 128;
|
|
64966
|
+
function isASCIINumberBytes(buffer2, start) {
|
|
64967
|
+
if (start >= buffer2.length) {
|
|
64612
64968
|
return false;
|
|
64613
64969
|
}
|
|
64614
|
-
for (let i = start; i <
|
|
64615
|
-
if (
|
|
64970
|
+
for (let i = start; i < buffer2.length; i++) {
|
|
64971
|
+
if (buffer2[i] < 48 || buffer2[i] > 57) {
|
|
64616
64972
|
return false;
|
|
64617
64973
|
}
|
|
64618
64974
|
}
|
|
64619
64975
|
return true;
|
|
64620
64976
|
}
|
|
64621
|
-
function isValidLastEventIdBytes(
|
|
64622
|
-
for (let i = start; i <
|
|
64623
|
-
if (
|
|
64977
|
+
function isValidLastEventIdBytes(buffer2, start) {
|
|
64978
|
+
for (let i = start; i < buffer2.length; i++) {
|
|
64979
|
+
if (buffer2[i] === 0) {
|
|
64624
64980
|
return false;
|
|
64625
64981
|
}
|
|
64626
64982
|
}
|
|
@@ -64637,6 +64993,11 @@ var require_eventsource_stream = __commonJS({
|
|
|
64637
64993
|
}
|
|
64638
64994
|
return true;
|
|
64639
64995
|
}
|
|
64996
|
+
function createMaxEventSizeExceededError() {
|
|
64997
|
+
const error = new Error("EventSource message size exceeded");
|
|
64998
|
+
error.aborted = false;
|
|
64999
|
+
return error;
|
|
65000
|
+
}
|
|
64640
65001
|
var EventSourceStream = class extends Transform {
|
|
64641
65002
|
/**
|
|
64642
65003
|
* @type {eventSourceSettings}
|
|
@@ -64663,6 +65024,13 @@ var require_eventsource_stream = __commonJS({
|
|
|
64663
65024
|
pos = 0;
|
|
64664
65025
|
lineChunkIndex = 0;
|
|
64665
65026
|
linePos = 0;
|
|
65027
|
+
lineLength = 0;
|
|
65028
|
+
eventSize = 0;
|
|
65029
|
+
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 };
|
|
65030
|
+
dataLineCount = 0;
|
|
65031
|
+
maxEventSize;
|
|
65032
|
+
maxDataLines;
|
|
65033
|
+
maxBufferedChunks;
|
|
64666
65034
|
event = {
|
|
64667
65035
|
data: void 0,
|
|
64668
65036
|
event: void 0,
|
|
@@ -64672,6 +65040,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
64672
65040
|
/**
|
|
64673
65041
|
* @param {object} options
|
|
64674
65042
|
* @param {boolean} [options.readableObjectMode]
|
|
65043
|
+
* @param {number} [options.maxEventSize]
|
|
64675
65044
|
* @param {eventSourceSettings} [options.eventSourceSettings]
|
|
64676
65045
|
* @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
|
|
64677
65046
|
*/
|
|
@@ -64679,6 +65048,10 @@ var require_eventsource_stream = __commonJS({
|
|
|
64679
65048
|
options.readableObjectMode = true;
|
|
64680
65049
|
super(options);
|
|
64681
65050
|
this.state = options.eventSourceSettings || {};
|
|
65051
|
+
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize;
|
|
65052
|
+
const parserItemLimit = this.maxEventSize > 0 ? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem))) : 0;
|
|
65053
|
+
this.maxDataLines = parserItemLimit;
|
|
65054
|
+
this.maxBufferedChunks = parserItemLimit;
|
|
64682
65055
|
if (options.push) {
|
|
64683
65056
|
this.push = options.push;
|
|
64684
65057
|
}
|
|
@@ -64694,6 +65067,10 @@ var require_eventsource_stream = __commonJS({
|
|
|
64694
65067
|
callback();
|
|
64695
65068
|
return;
|
|
64696
65069
|
}
|
|
65070
|
+
if (this.maxEventSize > 0 && this.chunks.length >= this.maxBufferedChunks && chunk2[0] !== LF && chunk2[0] !== CR) {
|
|
65071
|
+
callback(createMaxEventSizeExceededError());
|
|
65072
|
+
return;
|
|
65073
|
+
}
|
|
64697
65074
|
this.chunks.push(chunk2);
|
|
64698
65075
|
if (this.checkBOM) {
|
|
64699
65076
|
if (this.handleBOM()) {
|
|
@@ -64730,15 +65107,29 @@ var require_eventsource_stream = __commonJS({
|
|
|
64730
65107
|
if (byte === CR) {
|
|
64731
65108
|
this.crlfCheck = true;
|
|
64732
65109
|
}
|
|
64733
|
-
|
|
65110
|
+
try {
|
|
65111
|
+
this.parseLine(this.readLine(), this.event);
|
|
65112
|
+
} catch (error) {
|
|
65113
|
+
callback(error);
|
|
65114
|
+
return;
|
|
65115
|
+
}
|
|
64734
65116
|
this.consumeCurrentByte();
|
|
64735
65117
|
this.eventEndCheck = true;
|
|
64736
65118
|
continue;
|
|
64737
65119
|
}
|
|
65120
|
+
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
|
65121
|
+
callback(createMaxEventSizeExceededError());
|
|
65122
|
+
return;
|
|
65123
|
+
}
|
|
64738
65124
|
this.advanceCursor();
|
|
64739
65125
|
}
|
|
64740
65126
|
callback();
|
|
64741
65127
|
}
|
|
65128
|
+
_destroy(error, callback) {
|
|
65129
|
+
this.chunks.length = 0;
|
|
65130
|
+
this.clearEvent();
|
|
65131
|
+
super._destroy(error, callback);
|
|
65132
|
+
}
|
|
64742
65133
|
/**
|
|
64743
65134
|
* @param {Buffer} line
|
|
64744
65135
|
* @param {EventSourceStreamEvent} event
|
|
@@ -64761,6 +65152,12 @@ var require_eventsource_stream = __commonJS({
|
|
|
64761
65152
|
}
|
|
64762
65153
|
}
|
|
64763
65154
|
if (isFieldName(line, fieldLength, DATA)) {
|
|
65155
|
+
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
|
65156
|
+
throw createMaxEventSizeExceededError();
|
|
65157
|
+
}
|
|
65158
|
+
const valueBytes = line.length - valueStart;
|
|
65159
|
+
const dataSize = this.eventFieldSizes.data + (event.data === void 0 ? 0 : 1) + valueBytes;
|
|
65160
|
+
this.setEventFieldSize("data", dataSize);
|
|
64764
65161
|
const value = line.toString("utf8", valueStart);
|
|
64765
65162
|
if (event.data === void 0) {
|
|
64766
65163
|
event.data = value;
|
|
@@ -64768,27 +65165,38 @@ var require_eventsource_stream = __commonJS({
|
|
|
64768
65165
|
event.data += `
|
|
64769
65166
|
${value}`;
|
|
64770
65167
|
}
|
|
65168
|
+
this.dataLineCount++;
|
|
64771
65169
|
return;
|
|
64772
65170
|
}
|
|
64773
65171
|
if (isFieldName(line, fieldLength, RETRY)) {
|
|
64774
65172
|
if (isASCIINumberBytes(line, valueStart)) {
|
|
65173
|
+
this.setEventFieldSize("retry", line.length - valueStart);
|
|
64775
65174
|
event.retry = line.toString("utf8", valueStart);
|
|
64776
65175
|
}
|
|
64777
65176
|
return;
|
|
64778
65177
|
}
|
|
64779
65178
|
if (isFieldName(line, fieldLength, ID)) {
|
|
64780
65179
|
if (isValidLastEventIdBytes(line, valueStart)) {
|
|
65180
|
+
this.setEventFieldSize("id", line.length - valueStart);
|
|
64781
65181
|
event.id = line.toString("utf8", valueStart);
|
|
64782
65182
|
}
|
|
64783
65183
|
return;
|
|
64784
65184
|
}
|
|
64785
65185
|
if (isFieldName(line, fieldLength, EVENT)) {
|
|
64786
|
-
|
|
64787
|
-
|
|
64788
|
-
event.event =
|
|
65186
|
+
if (valueStart < line.length) {
|
|
65187
|
+
this.setEventFieldSize("event", line.length - valueStart);
|
|
65188
|
+
event.event = line.toString("utf8", valueStart);
|
|
64789
65189
|
}
|
|
64790
65190
|
}
|
|
64791
65191
|
}
|
|
65192
|
+
setEventFieldSize(field, size) {
|
|
65193
|
+
const eventSize = this.eventSize - this.eventFieldSizes[field] + size;
|
|
65194
|
+
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
|
|
65195
|
+
throw createMaxEventSizeExceededError();
|
|
65196
|
+
}
|
|
65197
|
+
this.eventSize = eventSize;
|
|
65198
|
+
this.eventFieldSizes[field] = size;
|
|
65199
|
+
}
|
|
64792
65200
|
/**
|
|
64793
65201
|
* @param {EventSourceStreamEvent} event
|
|
64794
65202
|
*/
|
|
@@ -64815,6 +65223,12 @@ ${value}`;
|
|
|
64815
65223
|
this.event.event = void 0;
|
|
64816
65224
|
this.event.id = void 0;
|
|
64817
65225
|
this.event.retry = void 0;
|
|
65226
|
+
this.eventSize = 0;
|
|
65227
|
+
this.dataLineCount = 0;
|
|
65228
|
+
this.eventFieldSizes.data = 0;
|
|
65229
|
+
this.eventFieldSizes.event = 0;
|
|
65230
|
+
this.eventFieldSizes.id = 0;
|
|
65231
|
+
this.eventFieldSizes.retry = 0;
|
|
64818
65232
|
}
|
|
64819
65233
|
hasPendingEvent() {
|
|
64820
65234
|
return this.event.data !== void 0 || this.event.event !== void 0 || this.event.id !== void 0 || this.event.retry !== void 0;
|
|
@@ -64839,13 +65253,15 @@ ${value}`;
|
|
|
64839
65253
|
syncLineStartToCursor() {
|
|
64840
65254
|
this.lineChunkIndex = this.chunkIndex;
|
|
64841
65255
|
this.linePos = this.pos;
|
|
65256
|
+
this.lineLength = 0;
|
|
64842
65257
|
this.dropConsumedChunks();
|
|
64843
65258
|
}
|
|
64844
65259
|
dropConsumedChunks() {
|
|
64845
|
-
|
|
64846
|
-
this.
|
|
64847
|
-
this.
|
|
64848
|
-
this.
|
|
65260
|
+
if (this.lineChunkIndex > 0) {
|
|
65261
|
+
const consumed = this.lineChunkIndex;
|
|
65262
|
+
this.chunks.splice(0, consumed);
|
|
65263
|
+
this.lineChunkIndex = 0;
|
|
65264
|
+
this.chunkIndex -= consumed;
|
|
64849
65265
|
}
|
|
64850
65266
|
if (this.chunkIndex === this.chunks.length) {
|
|
64851
65267
|
this.chunks.length = 0;
|
|
@@ -64947,6 +65363,7 @@ var require_eventsource = __commonJS({
|
|
|
64947
65363
|
var { isNetworkError } = require_response();
|
|
64948
65364
|
var { kEnumerableProperty } = require_util();
|
|
64949
65365
|
var { environmentSettingsObject } = require_util2();
|
|
65366
|
+
var { getGlobalDispatcher } = require_global2();
|
|
64950
65367
|
var experimentalWarned = false;
|
|
64951
65368
|
var defaultReconnectionTime = 3e3;
|
|
64952
65369
|
var CONNECTING = 0;
|
|
@@ -65088,6 +65505,7 @@ var require_eventsource = __commonJS({
|
|
|
65088
65505
|
this.#state.origin = response.urlList[response.urlList.length - 1].origin;
|
|
65089
65506
|
const eventSourceStream = new EventSourceStream({
|
|
65090
65507
|
eventSourceSettings: this.#state,
|
|
65508
|
+
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
|
65091
65509
|
push: (event) => {
|
|
65092
65510
|
this.dispatchEvent(createFastMessageEvent(
|
|
65093
65511
|
event.type,
|
|
@@ -65224,7 +65642,8 @@ var require_eventsource = __commonJS({
|
|
|
65224
65642
|
{
|
|
65225
65643
|
key: "dispatcher",
|
|
65226
65644
|
// undici only
|
|
65227
|
-
converter: webidl.converters.any
|
|
65645
|
+
converter: webidl.converters.any,
|
|
65646
|
+
defaultValue: () => getGlobalDispatcher()
|
|
65228
65647
|
},
|
|
65229
65648
|
{
|
|
65230
65649
|
key: "node",
|