@maiyunnet/kebab 9.26.2 → 9.26.3
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/doc/kebab-rag.md +22 -22
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/fs.js +1 -1
- package/package.json +1 -1
- package/sys/child.js +6 -14
- package/sys/ctr.js +1 -1
- package/sys/route.js +10 -11
package/doc/kebab-rag.md
CHANGED
|
@@ -1763,7 +1763,7 @@ index/variables/VER.md
|
|
|
1763
1763
|
|
|
1764
1764
|
# Variable: VER
|
|
1765
1765
|
|
|
1766
|
-
> `const` **VER**: `"9.26.
|
|
1766
|
+
> `const` **VER**: `"9.26.3"` = `'9.26.3'`
|
|
1767
1767
|
|
|
1768
1768
|
Defined in: [index.ts:9](https://github.com/maiyunnet/kebab/blob/master/index.ts#L9)
|
|
1769
1769
|
|
|
@@ -138282,7 +138282,7 @@ sys/route/functions/getFormData.md
|
|
|
138282
138282
|
|
|
138283
138283
|
> **getFormData**(`req`, `events?`, `limits?`): `Promise`\<`false` \| \{ `files`: `Record`\<`string`, [`IPostFile`](../../../index/interfaces/IPostFile.md) \| [`IPostFile`](../../../index/interfaces/IPostFile.md)[]\>; `post`: `Record`\<`string`, [`Json`](../../../index/type-aliases/Json.md)\>; \}\>
|
|
138284
138284
|
|
|
138285
|
-
Defined in: [sys/route.ts:
|
|
138285
|
+
Defined in: [sys/route.ts:1101](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1101)
|
|
138286
138286
|
|
|
138287
138287
|
获取 formdata 的 post
|
|
138288
138288
|
|
|
@@ -138325,7 +138325,7 @@ sys/route/functions/getPost.md
|
|
|
138325
138325
|
|
|
138326
138326
|
> **getPost**(`req`): `Promise`\<`false` \| \{ `input`: `string`; `post`: `Record`\<`string`, `any`\>; `raw`: `Record`\<`string`, `any`\>; \}\>
|
|
138327
138327
|
|
|
138328
|
-
Defined in: [sys/route.ts:
|
|
138328
|
+
Defined in: [sys/route.ts:936](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L936)
|
|
138329
138329
|
|
|
138330
138330
|
获取 post 对象(通常已自动获取),如果是文件上传(formdata)的情况则不获取
|
|
138331
138331
|
|
|
@@ -138356,7 +138356,7 @@ sys/route/functions/run.md
|
|
|
138356
138356
|
|
|
138357
138357
|
> **run**(`data`): `Promise`\<`boolean`\>
|
|
138358
138358
|
|
|
138359
|
-
Defined in: [sys/route.ts:
|
|
138359
|
+
Defined in: [sys/route.ts:109](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L109)
|
|
138360
138360
|
|
|
138361
138361
|
若为动态路径则执行此函数,此函数不进行判断 kebab.json 是否存在
|
|
138362
138362
|
|
|
@@ -138443,7 +138443,7 @@ sys/route/functions/unlinkUploadFiles.md
|
|
|
138443
138443
|
|
|
138444
138444
|
> **unlinkUploadFiles**(`cctr`): `Promise`\<`void`\>
|
|
138445
138445
|
|
|
138446
|
-
Defined in: [sys/route.ts:
|
|
138446
|
+
Defined in: [sys/route.ts:894](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L894)
|
|
138447
138447
|
|
|
138448
138448
|
删除本次请求所有已上传的临时文件
|
|
138449
138449
|
|
|
@@ -138472,7 +138472,7 @@ sys/route/functions/waitCtr.md
|
|
|
138472
138472
|
|
|
138473
138473
|
> **waitCtr**(`cctr`): `Promise`\<`void`\>
|
|
138474
138474
|
|
|
138475
|
-
Defined in: [sys/route.ts:
|
|
138475
|
+
Defined in: [sys/route.ts:914](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L914)
|
|
138476
138476
|
|
|
138477
138477
|
等待异步任务结束,并删除临时文件,如果结束后还有事务没关闭,则会在本函数中打印控制台并且写入 log 文件
|
|
138478
138478
|
此时其实已经给客户端返回了,此处等待不消耗客户端的等待时间
|
|
@@ -138526,7 +138526,7 @@ sys/route/interfaces/IFormDataError.md
|
|
|
138526
138526
|
|
|
138527
138527
|
# Interface: IFormDataError
|
|
138528
138528
|
|
|
138529
|
-
Defined in: [sys/route.ts:
|
|
138529
|
+
Defined in: [sys/route.ts:1056](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1056)
|
|
138530
138530
|
|
|
138531
138531
|
解析上传数据时的失败原因,只提供错误码和限制值,不带临时路径或异常对象
|
|
138532
138532
|
|
|
@@ -138536,7 +138536,7 @@ Defined in: [sys/route.ts:1058](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138536
138536
|
|
|
138537
138537
|
> **code**: `"INVALID_BOUNDARY"` \| `"FILE_TOO_LARGE"` \| `"TOTAL_TOO_LARGE"` \| `"FIELD_TOO_LARGE"` \| `"HEADER_TOO_LARGE"` \| `"TOO_MANY_PARTS"` \| `"FILE_TYPE"` \| `"TIMEOUT"` \| `"TEMP_FILE_ERROR"` \| `"REQUEST_ERROR"` \| `"REQUEST_ABORTED"`
|
|
138538
138538
|
|
|
138539
|
-
Defined in: [sys/route.ts:
|
|
138539
|
+
Defined in: [sys/route.ts:1057](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1057)
|
|
138540
138540
|
|
|
138541
138541
|
***
|
|
138542
138542
|
|
|
@@ -138544,7 +138544,7 @@ Defined in: [sys/route.ts:1059](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138544
138544
|
|
|
138545
138545
|
> `optional` **limit?**: `number`
|
|
138546
138546
|
|
|
138547
|
-
Defined in: [sys/route.ts:
|
|
138547
|
+
Defined in: [sys/route.ts:1061](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1061)
|
|
138548
138548
|
|
|
138549
138549
|
超出的限制值:大小用字节,超时用毫秒,字段和文件数量用个
|
|
138550
138550
|
|
|
@@ -138559,7 +138559,7 @@ sys/route/interfaces/IFormDataEvents.md
|
|
|
138559
138559
|
|
|
138560
138560
|
# Interface: IFormDataEvents
|
|
138561
138561
|
|
|
138562
|
-
Defined in: [sys/route.ts:
|
|
138562
|
+
Defined in: [sys/route.ts:1065](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1065)
|
|
138563
138563
|
|
|
138564
138564
|
multipart 文件处理及失败通知
|
|
138565
138565
|
|
|
@@ -138569,7 +138569,7 @@ multipart 文件处理及失败通知
|
|
|
138569
138569
|
|
|
138570
138570
|
> `optional` **onerror?**: (`error`) => `void`
|
|
138571
138571
|
|
|
138572
|
-
Defined in: [sys/route.ts:
|
|
138572
|
+
Defined in: [sys/route.ts:1073](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1073)
|
|
138573
138573
|
|
|
138574
138574
|
首次失败时调用一次,getFormData 返回 false;若连接已断开,可能无法回复客户端
|
|
138575
138575
|
|
|
@@ -138589,7 +138589,7 @@ Defined in: [sys/route.ts:1075](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138589
138589
|
|
|
138590
138590
|
> `optional` **onfiledata?**: (`chunk`) => `void`
|
|
138591
138591
|
|
|
138592
|
-
Defined in: [sys/route.ts:
|
|
138592
|
+
Defined in: [sys/route.ts:1069](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1069)
|
|
138593
138593
|
|
|
138594
138594
|
文件上传时触发,仅 start 返回 true 时触发
|
|
138595
138595
|
|
|
@@ -138609,7 +138609,7 @@ Defined in: [sys/route.ts:1071](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138609
138609
|
|
|
138610
138610
|
> `optional` **onfileend?**: () => `void`
|
|
138611
138611
|
|
|
138612
|
-
Defined in: [sys/route.ts:
|
|
138612
|
+
Defined in: [sys/route.ts:1071](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1071)
|
|
138613
138613
|
|
|
138614
138614
|
文件上传结束时触发,仅 start 返回 true 时触发
|
|
138615
138615
|
|
|
@@ -138623,7 +138623,7 @@ Defined in: [sys/route.ts:1073](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138623
138623
|
|
|
138624
138624
|
> `optional` **onfilestart?**: (`name`) => `boolean` \| `undefined`
|
|
138625
138625
|
|
|
138626
|
-
Defined in: [sys/route.ts:
|
|
138626
|
+
Defined in: [sys/route.ts:1067](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1067)
|
|
138627
138627
|
|
|
138628
138628
|
文件开始上传时触发,返回 true 则跳过该文件的保存
|
|
138629
138629
|
|
|
@@ -138648,7 +138648,7 @@ sys/route/interfaces/IFormDataLimits.md
|
|
|
138648
138648
|
|
|
138649
138649
|
# Interface: IFormDataLimits
|
|
138650
138650
|
|
|
138651
|
-
Defined in: [sys/route.ts:
|
|
138651
|
+
Defined in: [sys/route.ts:1077](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1077)
|
|
138652
138652
|
|
|
138653
138653
|
multipart 上传限制
|
|
138654
138654
|
|
|
@@ -138658,7 +138658,7 @@ multipart 上传限制
|
|
|
138658
138658
|
|
|
138659
138659
|
> `optional` **allowedExts?**: `string`[]
|
|
138660
138660
|
|
|
138661
|
-
Defined in: [sys/route.ts:
|
|
138661
|
+
Defined in: [sys/route.ts:1081](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1081)
|
|
138662
138662
|
|
|
138663
138663
|
允许的文件扩展名(含点号),如 ['.jpg', '.png', '.pdf']
|
|
138664
138664
|
|
|
@@ -138668,7 +138668,7 @@ Defined in: [sys/route.ts:1083](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138668
138668
|
|
|
138669
138669
|
> `optional` **maxFieldSize?**: `number`
|
|
138670
138670
|
|
|
138671
|
-
Defined in: [sys/route.ts:
|
|
138671
|
+
Defined in: [sys/route.ts:1083](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1083)
|
|
138672
138672
|
|
|
138673
138673
|
单个字段(非文件)最大字节数,默认 1 MB
|
|
138674
138674
|
|
|
@@ -138678,7 +138678,7 @@ Defined in: [sys/route.ts:1085](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138678
138678
|
|
|
138679
138679
|
> `optional` **maxFileSize?**: `number`
|
|
138680
138680
|
|
|
138681
|
-
Defined in: [sys/route.ts:
|
|
138681
|
+
Defined in: [sys/route.ts:1079](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1079)
|
|
138682
138682
|
|
|
138683
138683
|
单个文件最大字节数
|
|
138684
138684
|
|
|
@@ -138688,7 +138688,7 @@ Defined in: [sys/route.ts:1081](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138688
138688
|
|
|
138689
138689
|
> `optional` **maxHeaderSize?**: `number`
|
|
138690
138690
|
|
|
138691
|
-
Defined in: [sys/route.ts:
|
|
138691
|
+
Defined in: [sys/route.ts:1087](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1087)
|
|
138692
138692
|
|
|
138693
138693
|
每个字段或文件的 multipart 头部最多多少字节,默认 16 KB
|
|
138694
138694
|
|
|
@@ -138698,7 +138698,7 @@ Defined in: [sys/route.ts:1089](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138698
138698
|
|
|
138699
138699
|
> `optional` **maxParts?**: `number`
|
|
138700
138700
|
|
|
138701
|
-
Defined in: [sys/route.ts:
|
|
138701
|
+
Defined in: [sys/route.ts:1089](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1089)
|
|
138702
138702
|
|
|
138703
138703
|
multipart 字段与文件总数量,默认 1000
|
|
138704
138704
|
|
|
@@ -138708,7 +138708,7 @@ multipart 字段与文件总数量,默认 1000
|
|
|
138708
138708
|
|
|
138709
138709
|
> `optional` **maxTotalSize?**: `number`
|
|
138710
138710
|
|
|
138711
|
-
Defined in: [sys/route.ts:
|
|
138711
|
+
Defined in: [sys/route.ts:1085](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1085)
|
|
138712
138712
|
|
|
138713
138713
|
整体请求最大字节数,不设置或设为 0 则不限制
|
|
138714
138714
|
|
|
@@ -138718,6 +138718,6 @@ Defined in: [sys/route.ts:1087](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138718
138718
|
|
|
138719
138719
|
> `optional` **timeout?**: `number`
|
|
138720
138720
|
|
|
138721
|
-
Defined in: [sys/route.ts:
|
|
138721
|
+
Defined in: [sys/route.ts:1091](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1091)
|
|
138722
138722
|
|
|
138723
138723
|
整体请求超时时间(毫秒),默认 5 分钟,设为 0 禁用超时
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
6
6
|
*/
|
|
7
7
|
/** --- 当前系统版本号 --- */
|
|
8
|
-
export const VER = '9.26.
|
|
8
|
+
export const VER = '9.26.3';
|
|
9
9
|
// --- 服务端用的路径 ---
|
|
10
10
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
11
11
|
/** --- /xxx/xxx --- */
|
package/lib/fs.js
CHANGED
|
@@ -414,7 +414,7 @@ async function* readFileRanges(path, ranges, headers, footer) {
|
|
|
414
414
|
export async function readToResponse(path, req, res, stat) {
|
|
415
415
|
stat ??= await stats(path);
|
|
416
416
|
if (!stat) {
|
|
417
|
-
const content = '<h1>404 Not found</h1
|
|
417
|
+
const content = '<h1>404 Not found</h1>';
|
|
418
418
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
419
419
|
lCore.writeHead(res, 404);
|
|
420
420
|
res.end(req.method === 'HEAD' ? '' : content);
|
package/package.json
CHANGED
package/sys/child.js
CHANGED
|
@@ -49,8 +49,6 @@ const hbTimer = setInterval(function () {
|
|
|
49
49
|
const certList = new Map();
|
|
50
50
|
/** --- servername → certList mapKey 索引缓存 --- */
|
|
51
51
|
let certHostIndex = {};
|
|
52
|
-
/** --- 默认证书 --- */
|
|
53
|
-
let defaultSc;
|
|
54
52
|
/** --- 最后一次加载证书到内存的时间 --- */
|
|
55
53
|
let certLastLoad = 0;
|
|
56
54
|
/** --- 当前的虚拟主机配置列表 - 读取于 conf/vhost/*.json --- */
|
|
@@ -135,10 +133,6 @@ async function run() {
|
|
|
135
133
|
certHostIndex[servername] = mapKey;
|
|
136
134
|
return;
|
|
137
135
|
}
|
|
138
|
-
if (defaultSc) {
|
|
139
|
-
cb(null, defaultSc);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
136
|
lCore.display(`[CHILD][SNICallback] CERT NOT FOUND for servername: ${servername}`);
|
|
143
137
|
const err = new Error('CERT NOT FOUND');
|
|
144
138
|
cb(err);
|
|
@@ -227,15 +221,14 @@ async function requestHandler(req, res, https) {
|
|
|
227
221
|
// --- 已经开始输出的,需要用户自行处理 ---
|
|
228
222
|
return;
|
|
229
223
|
}
|
|
230
|
-
const content = '<h1>504 Gateway Timeout</h1
|
|
224
|
+
const content = '<h1>504 Gateway Timeout</h1>';
|
|
231
225
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
232
226
|
lCore.writeHead(res, 504);
|
|
233
227
|
res.end(content);
|
|
234
228
|
}
|
|
235
229
|
};
|
|
236
230
|
timer.timer = setTimeout(timer.callback, timer.timeout);
|
|
237
|
-
|
|
238
|
-
res.setHeader('Server', 'Kebab/' + kebab.VER);
|
|
231
|
+
res.setHeader('Server', 'Kebab');
|
|
239
232
|
res.setHeader('expires', 'Mon, 26 Jul 1994 05:00:00 GMT');
|
|
240
233
|
res.setHeader('cache-control', 'no-store');
|
|
241
234
|
// --- 停止中:通知 HTTP/1.1 客户端不要复用此连接(HTTP/2 由 GOAWAY 帧处理) ---
|
|
@@ -284,7 +277,7 @@ async function requestHandler(req, res, https) {
|
|
|
284
277
|
/** --- 'abc' / 'def.json' --- */
|
|
285
278
|
let stat = await lFs.stats(vhost.real + now + item);
|
|
286
279
|
if (!stat) {
|
|
287
|
-
const content = '<h1>404 Not found</h1
|
|
280
|
+
const content = '<h1>404 Not found</h1>';
|
|
288
281
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
289
282
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
290
283
|
lCore.writeHead(res, 404);
|
|
@@ -325,7 +318,7 @@ async function requestHandler(req, res, https) {
|
|
|
325
318
|
'cookie': {},
|
|
326
319
|
'headers': {},
|
|
327
320
|
}, '[CHILD][requestHandler][E0]' + lText.stringifyError(e), '-error');
|
|
328
|
-
const content = '<h1>500 Server Error</h1
|
|
321
|
+
const content = '<h1>500 Server Error</h1>';
|
|
329
322
|
if (!res.headersSent) {
|
|
330
323
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
331
324
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
@@ -368,7 +361,7 @@ async function requestHandler(req, res, https) {
|
|
|
368
361
|
}
|
|
369
362
|
catch (e) {
|
|
370
363
|
lCore.log({}, '[CHILD][requestHandler][E1]' + lText.stringifyError(e), '-error');
|
|
371
|
-
const content = '<h1>500 Server Error</h1
|
|
364
|
+
const content = '<h1>500 Server Error</h1>';
|
|
372
365
|
if (!res.headersSent) {
|
|
373
366
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
374
367
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
@@ -391,7 +384,7 @@ async function requestHandler(req, res, https) {
|
|
|
391
384
|
return;
|
|
392
385
|
}
|
|
393
386
|
}
|
|
394
|
-
const content = '<h1>403 Forbidden</h1
|
|
387
|
+
const content = '<h1>403 Forbidden</h1>';
|
|
395
388
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
396
389
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
397
390
|
lCore.writeHead(res, 403);
|
|
@@ -584,7 +577,6 @@ async function reloadCert() {
|
|
|
584
577
|
}
|
|
585
578
|
}
|
|
586
579
|
}
|
|
587
|
-
defaultSc = certList.size > 0 ? certList.values().next().value.sc : undefined;
|
|
588
580
|
certHostIndex = {};
|
|
589
581
|
}
|
|
590
582
|
/**
|
package/sys/ctr.js
CHANGED
|
@@ -345,7 +345,7 @@ export class Ctr {
|
|
|
345
345
|
lCore.debug(`[CTR][_loadReactPage] ${message}`);
|
|
346
346
|
lCore.log(this, `[CTR][_loadReactPage] ${detail}`, '-error');
|
|
347
347
|
this._httpCode = 500;
|
|
348
|
-
return '<h1>500 Server Error</h1
|
|
348
|
+
return '<h1>500 Server Error</h1>';
|
|
349
349
|
}
|
|
350
350
|
/**
|
|
351
351
|
* --- 设置校验错误返回值 ---
|
package/sys/route.js
CHANGED
|
@@ -37,7 +37,7 @@ export function clearKebabConfigs() {
|
|
|
37
37
|
* @param res 响应对象
|
|
38
38
|
*/
|
|
39
39
|
function respond500(res) {
|
|
40
|
-
const content = '<h1>500 Server Error</h1
|
|
40
|
+
const content = '<h1>500 Server Error</h1>';
|
|
41
41
|
if (!res.headersSent) {
|
|
42
42
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
43
43
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
@@ -65,9 +65,8 @@ function setInputValue(target, key, value) {
|
|
|
65
65
|
* --- 输出 404 错误响应 ---
|
|
66
66
|
* @param res 响应对象
|
|
67
67
|
* @param config 配置对象(用于检查 #404 路由)
|
|
68
|
-
* @param path 请求路径
|
|
69
68
|
*/
|
|
70
|
-
function respond404(res, config
|
|
69
|
+
function respond404(res, config) {
|
|
71
70
|
if (config?.route?.['#404']) {
|
|
72
71
|
if (!res.headersSent) {
|
|
73
72
|
res.setHeader('location', lText.urlResolve(config.const.urlBase, config.route['#404']));
|
|
@@ -78,7 +77,7 @@ function respond404(res, config, path) {
|
|
|
78
77
|
}
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
81
|
-
const content = '
|
|
80
|
+
const content = '<h1>404 Not found</h1>';
|
|
82
81
|
if (!res.headersSent) {
|
|
83
82
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
84
83
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
@@ -98,7 +97,7 @@ export async function run(data) {
|
|
|
98
97
|
const configContent = await lFs.getContent(data.rootPath + 'kebab.json', 'utf8');
|
|
99
98
|
if (!configContent) {
|
|
100
99
|
if (data.res) {
|
|
101
|
-
const content = '<h1>500
|
|
100
|
+
const content = '<h1>500 Server Error</h1>';
|
|
102
101
|
data.res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
103
102
|
data.res.setHeader('content-length', Buffer.byteLength(content));
|
|
104
103
|
lCore.writeHead(data.res, 500);
|
|
@@ -260,7 +259,7 @@ export async function run(data) {
|
|
|
260
259
|
// --- 若文件名为保留的 middle 将不允许进行 ---
|
|
261
260
|
if (pathLeft.startsWith('middle')) {
|
|
262
261
|
if (data.res) {
|
|
263
|
-
respond404(data.res, config
|
|
262
|
+
respond404(data.res, config);
|
|
264
263
|
}
|
|
265
264
|
else {
|
|
266
265
|
data.socket?.destroy();
|
|
@@ -514,7 +513,7 @@ export async function run(data) {
|
|
|
514
513
|
const filePath = config.const.ctrPath + pathLeft + '.js';
|
|
515
514
|
if (!await lFs.isFile(filePath)) {
|
|
516
515
|
// --- 指定的控制器不存在 ---
|
|
517
|
-
respond404(data.res, config
|
|
516
|
+
respond404(data.res, config);
|
|
518
517
|
return true;
|
|
519
518
|
}
|
|
520
519
|
// --- 加载控制器文件 ---
|
|
@@ -553,11 +552,11 @@ export async function run(data) {
|
|
|
553
552
|
});
|
|
554
553
|
// --- 按实际调用名检查,框架基类及 Object 原型的成员不能作为 action ---
|
|
555
554
|
if (pathRight.startsWith('_') || pathRight in sCtr.Ctr.prototype) {
|
|
556
|
-
respond404(data.res, config
|
|
555
|
+
respond404(data.res, config);
|
|
557
556
|
return true;
|
|
558
557
|
}
|
|
559
558
|
if ((cctr[pathRight] === undefined) || (typeof cctr[pathRight] !== 'function')) {
|
|
560
|
-
respond404(data.res, config
|
|
559
|
+
respond404(data.res, config);
|
|
561
560
|
return true;
|
|
562
561
|
}
|
|
563
562
|
// --- 执行 onLoad 方法 ---
|
|
@@ -694,7 +693,7 @@ export async function run(data) {
|
|
|
694
693
|
lCore.writeHead(data.res, 500);
|
|
695
694
|
}
|
|
696
695
|
if (!data.res.writableEnded) {
|
|
697
|
-
data.res.end('<h1>500 Internal server error</h1
|
|
696
|
+
data.res.end('<h1>500 Internal server error</h1>');
|
|
698
697
|
}
|
|
699
698
|
}
|
|
700
699
|
else {
|
|
@@ -801,7 +800,7 @@ export async function run(data) {
|
|
|
801
800
|
lCore.writeHead(data.res, 500);
|
|
802
801
|
}
|
|
803
802
|
if (!data.res.writableEnded) {
|
|
804
|
-
data.res.end('<h1>500 Internal server error</h1
|
|
803
|
+
data.res.end('<h1>500 Internal server error</h1>');
|
|
805
804
|
}
|
|
806
805
|
}
|
|
807
806
|
await waitCtr(cctr ?? middle);
|