vite-plugin-rpx 0.11.34 → 0.11.36
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/index.js +59 -40
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -23434,6 +23434,7 @@ function chunkedStream(pool, conn, closeConn) {
|
|
|
23434
23434
|
conn.streamingBody = true;
|
|
23435
23435
|
let remaining = 0;
|
|
23436
23436
|
let needTrailerCrlf = false;
|
|
23437
|
+
let cancelled = false;
|
|
23437
23438
|
async function readLine() {
|
|
23438
23439
|
for (;; ) {
|
|
23439
23440
|
for (let i2 = conn.pos;i2 + 1 < conn.len; i2++) {
|
|
@@ -23452,52 +23453,59 @@ function chunkedStream(pool, conn, closeConn) {
|
|
|
23452
23453
|
}
|
|
23453
23454
|
return new ReadableStream({
|
|
23454
23455
|
async pull(controller) {
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
if (
|
|
23458
|
-
if (conn.
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23456
|
+
try {
|
|
23457
|
+
for (;; ) {
|
|
23458
|
+
if (remaining > 0) {
|
|
23459
|
+
if (conn.len === conn.pos) {
|
|
23460
|
+
if (conn.closed) {
|
|
23461
|
+
pool.destroy(conn);
|
|
23462
|
+
controller.error(new Error("upstream closed mid-chunk"));
|
|
23463
|
+
return;
|
|
23464
|
+
}
|
|
23465
|
+
await conn.waitForData(conn.len);
|
|
23466
|
+
continue;
|
|
23462
23467
|
}
|
|
23463
|
-
|
|
23464
|
-
|
|
23468
|
+
const take = Math.min(remaining, conn.len - conn.pos);
|
|
23469
|
+
controller.enqueue(conn.buf.slice(conn.pos, conn.pos + take));
|
|
23470
|
+
conn.pos += take;
|
|
23471
|
+
remaining -= take;
|
|
23472
|
+
conn.resumeIfDrained();
|
|
23473
|
+
if (remaining === 0)
|
|
23474
|
+
needTrailerCrlf = true;
|
|
23475
|
+
return;
|
|
23465
23476
|
}
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
remaining -= take;
|
|
23470
|
-
conn.resumeIfDrained();
|
|
23471
|
-
if (remaining === 0)
|
|
23472
|
-
needTrailerCrlf = true;
|
|
23473
|
-
return;
|
|
23474
|
-
}
|
|
23475
|
-
if (needTrailerCrlf) {
|
|
23476
|
-
await readLine();
|
|
23477
|
-
needTrailerCrlf = false;
|
|
23478
|
-
}
|
|
23479
|
-
const sizeLine = await readLine();
|
|
23480
|
-
const semi = sizeLine.indexOf(";");
|
|
23481
|
-
const size = Number.parseInt(semi === -1 ? sizeLine : sizeLine.slice(0, semi), 16);
|
|
23482
|
-
if (!Number.isInteger(size) || size < 0) {
|
|
23483
|
-
pool.destroy(conn);
|
|
23484
|
-
controller.error(new Error("upstream sent malformed chunk size"));
|
|
23485
|
-
return;
|
|
23486
|
-
}
|
|
23487
|
-
if (size === 0) {
|
|
23488
|
-
for (;; ) {
|
|
23489
|
-
const t2 = await readLine();
|
|
23490
|
-
if (t2 === "")
|
|
23491
|
-
break;
|
|
23477
|
+
if (needTrailerCrlf) {
|
|
23478
|
+
await readLine();
|
|
23479
|
+
needTrailerCrlf = false;
|
|
23492
23480
|
}
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23481
|
+
const sizeLine = await readLine();
|
|
23482
|
+
const semi = sizeLine.indexOf(";");
|
|
23483
|
+
const size = Number.parseInt(semi === -1 ? sizeLine : sizeLine.slice(0, semi), 16);
|
|
23484
|
+
if (!Number.isInteger(size) || size < 0) {
|
|
23485
|
+
pool.destroy(conn);
|
|
23486
|
+
controller.error(new Error("upstream sent malformed chunk size"));
|
|
23487
|
+
return;
|
|
23488
|
+
}
|
|
23489
|
+
if (size === 0) {
|
|
23490
|
+
for (;; ) {
|
|
23491
|
+
const t2 = await readLine();
|
|
23492
|
+
if (t2 === "")
|
|
23493
|
+
break;
|
|
23494
|
+
}
|
|
23495
|
+
finishConn(pool, conn, closeConn);
|
|
23496
|
+
controller.close();
|
|
23497
|
+
return;
|
|
23498
|
+
}
|
|
23499
|
+
remaining = size;
|
|
23496
23500
|
}
|
|
23497
|
-
|
|
23501
|
+
} catch (error) {
|
|
23502
|
+
pool.destroy(conn);
|
|
23503
|
+
if (!cancelled)
|
|
23504
|
+
controller.error(error);
|
|
23498
23505
|
}
|
|
23499
23506
|
},
|
|
23500
23507
|
cancel() {
|
|
23508
|
+
cancelled = true;
|
|
23501
23509
|
pool.destroy(conn);
|
|
23502
23510
|
}
|
|
23503
23511
|
});
|
|
@@ -24173,6 +24181,12 @@ var init_sni = __esm(() => {
|
|
|
24173
24181
|
// ../rpx/src/on-demand.ts
|
|
24174
24182
|
import * as fsp2 from "node:fs/promises";
|
|
24175
24183
|
import * as path5 from "node:path";
|
|
24184
|
+
function resolveCertificateReloadStrategy(env = process.env) {
|
|
24185
|
+
const explicit = env.RPX_TLS_RELOAD_STRATEGY?.trim().toLowerCase();
|
|
24186
|
+
if (explicit === "restart" || explicit === "rebind")
|
|
24187
|
+
return explicit;
|
|
24188
|
+
return env.INVOCATION_ID ? "restart" : "rebind";
|
|
24189
|
+
}
|
|
24176
24190
|
function matchesAllowedSuffix(host, suffixes) {
|
|
24177
24191
|
if (!suffixes || suffixes.length === 0)
|
|
24178
24192
|
return false;
|
|
@@ -26837,7 +26851,12 @@ async function startProxies(options) {
|
|
|
26837
26851
|
initial: productionTlsConfig,
|
|
26838
26852
|
verbose,
|
|
26839
26853
|
onCertAdded: (entries) => {
|
|
26840
|
-
|
|
26854
|
+
if (resolveCertificateReloadStrategy() === "restart") {
|
|
26855
|
+
debugLog("on-demand", "certificate installed; restarting supervised gateway to reload TLS", verbose);
|
|
26856
|
+
setTimeout(() => process31.kill(process31.pid, "SIGTERM"), 10).unref();
|
|
26857
|
+
} else {
|
|
26858
|
+
rebuildSharedTls(entries);
|
|
26859
|
+
}
|
|
26841
26860
|
}
|
|
26842
26861
|
}) : null;
|
|
26843
26862
|
let rebuildLatest = null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-rpx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.36",
|
|
5
5
|
"description": "A modern and smart reverse proxy. Vite plugin.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typecheck": "bunx tsc --noEmit"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@stacksjs/rpx": "0.11.
|
|
50
|
+
"@stacksjs/rpx": "0.11.36",
|
|
51
51
|
"@stacksjs/tlsx": "^0.13.13"
|
|
52
52
|
},
|
|
53
53
|
"simple-git-hooks": {
|