@maiyunnet/kebab 5.0.1 → 5.0.2

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/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "5.0.1";
8
+ export declare const VER = "5.0.2";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  export declare const LIB_PATH: string;
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '5.0.1';
9
+ export const VER = '5.0.2';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/db/conn.js CHANGED
@@ -174,7 +174,7 @@ export class Connection {
174
174
  catch (e) {
175
175
  rtn.error = {
176
176
  'message': e.message,
177
- 'errno': e.errno ?? Number(e.code),
177
+ 'errno': e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, '')),
178
178
  };
179
179
  rtn.result = -500;
180
180
  }
@@ -241,7 +241,7 @@ export class Connection {
241
241
  }
242
242
  }
243
243
  catch (e) {
244
- let errno = e.errno ?? Number(e.code.replace(/[a-z][A-Z]/g, ''));
244
+ let errno = e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, ''));
245
245
  if (errno === 23505) {
246
246
  errno = 1062;
247
247
  }
package/lib/db/pool.js CHANGED
@@ -217,7 +217,7 @@ export class Pool {
217
217
  c.using();
218
218
  link.on('error', function (err) {
219
219
  c.setLost();
220
- if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
220
+ if (err.code !== 'PROTOCOL_CONNECTION_LOST' && err.code !== 'ECONNRESET') {
221
221
  lCore.debug('[DB][_getConnection][MYSQL][error]', err);
222
222
  lCore.log({}, '[DB][_getConnection][MYSQL][error] ' + err.message, '-error');
223
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
package/sys/child.js CHANGED
@@ -227,11 +227,12 @@ async function requestHandler(req, res, https) {
227
227
  let host = req.headers[':authority'];
228
228
  if (host === undefined || typeof host !== 'string') {
229
229
  host = req.headers['host'];
230
- if (host === undefined) {
231
- res.end();
232
- return;
233
- }
234
230
  }
231
+ if (host === undefined) {
232
+ res.end();
233
+ return;
234
+ }
235
+ host = host.split(':')[0] + ':' + (req.socket.localPort ?? (https ? '443' : '80'));
235
236
  const uri = lText.parseUrl(`http${https ? 's' : ''}://${host}${req.url ?? ''}`);
236
237
  /** --- 当前的 vhost 配置文件 --- */
237
238
  const vhost = await getVhostByHostname(uri.hostname ?? '');