vite-plugin-rpx 0.11.34 → 0.11.35
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 +47 -39
- 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
|
});
|
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.35",
|
|
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.35",
|
|
51
51
|
"@stacksjs/tlsx": "^0.13.13"
|
|
52
52
|
},
|
|
53
53
|
"simple-git-hooks": {
|