@maiyunnet/kebab 9.11.9 → 9.12.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/doc/kebab-rag.md +50 -50
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/undici.js +18 -3
- package/package.json +1 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.
|
|
1363
|
+
> `const` **VER**: `"9.12.1"` = `'9.12.1'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -18070,7 +18070,7 @@ lib/undici/functions/fetch.md
|
|
|
18070
18070
|
|
|
18071
18071
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
18072
18072
|
|
|
18073
|
-
Defined in: [lib/undici.ts:
|
|
18073
|
+
Defined in: [lib/undici.ts:175](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L175)
|
|
18074
18074
|
|
|
18075
18075
|
发起一个完全兼容 fetch 的请求
|
|
18076
18076
|
|
|
@@ -18105,7 +18105,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
18105
18105
|
|
|
18106
18106
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
18107
18107
|
|
|
18108
|
-
Defined in: [lib/undici.ts:
|
|
18108
|
+
Defined in: [lib/undici.ts:531](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L531)
|
|
18109
18109
|
|
|
18110
18110
|
剔除不代理的 header,返回新的 header
|
|
18111
18111
|
|
|
@@ -18146,7 +18146,7 @@ lib/undici/functions/getFormData.md
|
|
|
18146
18146
|
|
|
18147
18147
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
18148
18148
|
|
|
18149
|
-
Defined in: [lib/undici.ts:
|
|
18149
|
+
Defined in: [lib/undici.ts:515](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L515)
|
|
18150
18150
|
|
|
18151
18151
|
创建 FormData 对象
|
|
18152
18152
|
|
|
@@ -18167,7 +18167,7 @@ lib/undici/functions/get.md
|
|
|
18167
18167
|
|
|
18168
18168
|
> **get**(`u`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18169
18169
|
|
|
18170
|
-
Defined in: [lib/undici.ts:
|
|
18170
|
+
Defined in: [lib/undici.ts:90](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L90)
|
|
18171
18171
|
|
|
18172
18172
|
发起一个 get 请求
|
|
18173
18173
|
|
|
@@ -18202,7 +18202,7 @@ lib/undici/functions/getProxyAgent.md
|
|
|
18202
18202
|
|
|
18203
18203
|
> **getProxyAgent**(`url`): `ProxyAgent`
|
|
18204
18204
|
|
|
18205
|
-
Defined in: [lib/undici.ts:
|
|
18205
|
+
Defined in: [lib/undici.ts:21](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L21)
|
|
18206
18206
|
|
|
18207
18207
|
获取代理 agent
|
|
18208
18208
|
|
|
@@ -18229,7 +18229,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
18229
18229
|
|
|
18230
18230
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
18231
18231
|
|
|
18232
|
-
Defined in: [lib/undici.ts:
|
|
18232
|
+
Defined in: [lib/undici.ts:154](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L154)
|
|
18233
18233
|
|
|
18234
18234
|
发起 GET 请求并解析 JSON 响应
|
|
18235
18235
|
|
|
@@ -18266,7 +18266,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18266
18266
|
|
|
18267
18267
|
> **mproxyData**(`ctr`): `any`
|
|
18268
18268
|
|
|
18269
|
-
Defined in: [lib/undici.ts:
|
|
18269
|
+
Defined in: [lib/undici.ts:620](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L620)
|
|
18270
18270
|
|
|
18271
18271
|
获取 mproxy 的附加数据
|
|
18272
18272
|
|
|
@@ -18295,7 +18295,7 @@ lib/undici/functions/mproxy.md
|
|
|
18295
18295
|
|
|
18296
18296
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18297
18297
|
|
|
18298
|
-
Defined in: [lib/undici.ts:
|
|
18298
|
+
Defined in: [lib/undici.ts:567](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L567)
|
|
18299
18299
|
|
|
18300
18300
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18301
18301
|
get: url, auth
|
|
@@ -18337,7 +18337,7 @@ lib/undici/functions/open.md
|
|
|
18337
18337
|
|
|
18338
18338
|
> **open**(`u`): [`Request`](../request/classes/Request.md)
|
|
18339
18339
|
|
|
18340
|
-
Defined in: [lib/undici.ts:
|
|
18340
|
+
Defined in: [lib/undici.ts:81](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L81)
|
|
18341
18341
|
|
|
18342
18342
|
创建一个请求对象
|
|
18343
18343
|
|
|
@@ -18364,7 +18364,7 @@ lib/undici/functions/postJson.md
|
|
|
18364
18364
|
|
|
18365
18365
|
> **postJson**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18366
18366
|
|
|
18367
|
-
Defined in: [lib/undici.ts:
|
|
18367
|
+
Defined in: [lib/undici.ts:115](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L115)
|
|
18368
18368
|
|
|
18369
18369
|
发起 JSON 请求
|
|
18370
18370
|
|
|
@@ -18405,7 +18405,7 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
18405
18405
|
|
|
18406
18406
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18407
18407
|
|
|
18408
|
-
Defined in: [lib/undici.ts:
|
|
18408
|
+
Defined in: [lib/undici.ts:131](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L131)
|
|
18409
18409
|
|
|
18410
18410
|
发起 JSON 请求并解析 JSON 响应,失败时返回 null
|
|
18411
18411
|
|
|
@@ -18446,7 +18446,7 @@ lib/undici/functions/post.md
|
|
|
18446
18446
|
|
|
18447
18447
|
> **post**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18448
18448
|
|
|
18449
|
-
Defined in: [lib/undici.ts:
|
|
18449
|
+
Defined in: [lib/undici.ts:100](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L100)
|
|
18450
18450
|
|
|
18451
18451
|
发起一个 post 请求
|
|
18452
18452
|
|
|
@@ -18487,7 +18487,7 @@ lib/undici/functions/request.md
|
|
|
18487
18487
|
|
|
18488
18488
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18489
18489
|
|
|
18490
|
-
Defined in: [lib/undici.ts:
|
|
18490
|
+
Defined in: [lib/undici.ts:344](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L344)
|
|
18491
18491
|
|
|
18492
18492
|
发起一个请求
|
|
18493
18493
|
|
|
@@ -18524,7 +18524,7 @@ lib/undici/functions/rproxy.md
|
|
|
18524
18524
|
|
|
18525
18525
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18526
18526
|
|
|
18527
|
-
Defined in: [lib/undici.ts:
|
|
18527
|
+
Defined in: [lib/undici.ts:650](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L650)
|
|
18528
18528
|
|
|
18529
18529
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
18530
18530
|
|
|
@@ -18612,7 +18612,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
18612
18612
|
|
|
18613
18613
|
# Interface: IMproxyOptions
|
|
18614
18614
|
|
|
18615
|
-
Defined in: [lib/undici.ts:
|
|
18615
|
+
Defined in: [lib/undici.ts:758](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L758)
|
|
18616
18616
|
|
|
18617
18617
|
正向代理请求的传入参数选项
|
|
18618
18618
|
|
|
@@ -18622,7 +18622,7 @@ Defined in: [lib/undici.ts:743](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18622
18622
|
|
|
18623
18623
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18624
18624
|
|
|
18625
|
-
Defined in: [lib/undici.ts:
|
|
18625
|
+
Defined in: [lib/undici.ts:767](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L767)
|
|
18626
18626
|
|
|
18627
18627
|
过滤 header,返回 true 则留下
|
|
18628
18628
|
|
|
@@ -18642,7 +18642,7 @@ Defined in: [lib/undici.ts:752](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18642
18642
|
|
|
18643
18643
|
> `optional` **follow?**: `number`
|
|
18644
18644
|
|
|
18645
|
-
Defined in: [lib/undici.ts:
|
|
18645
|
+
Defined in: [lib/undici.ts:761](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L761)
|
|
18646
18646
|
|
|
18647
18647
|
***
|
|
18648
18648
|
|
|
@@ -18650,7 +18650,7 @@ Defined in: [lib/undici.ts:746](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18650
18650
|
|
|
18651
18651
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18652
18652
|
|
|
18653
|
-
Defined in: [lib/undici.ts:
|
|
18653
|
+
Defined in: [lib/undici.ts:765](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L765)
|
|
18654
18654
|
|
|
18655
18655
|
***
|
|
18656
18656
|
|
|
@@ -18658,7 +18658,7 @@ Defined in: [lib/undici.ts:750](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18658
18658
|
|
|
18659
18659
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18660
18660
|
|
|
18661
|
-
Defined in: [lib/undici.ts:
|
|
18661
|
+
Defined in: [lib/undici.ts:763](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L763)
|
|
18662
18662
|
|
|
18663
18663
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18664
18664
|
|
|
@@ -18668,7 +18668,7 @@ Defined in: [lib/undici.ts:748](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18668
18668
|
|
|
18669
18669
|
> `optional` **local?**: `string`
|
|
18670
18670
|
|
|
18671
|
-
Defined in: [lib/undici.ts:
|
|
18671
|
+
Defined in: [lib/undici.ts:764](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L764)
|
|
18672
18672
|
|
|
18673
18673
|
***
|
|
18674
18674
|
|
|
@@ -18676,7 +18676,7 @@ Defined in: [lib/undici.ts:749](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18676
18676
|
|
|
18677
18677
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18678
18678
|
|
|
18679
|
-
Defined in: [lib/undici.ts:
|
|
18679
|
+
Defined in: [lib/undici.ts:769](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L769)
|
|
18680
18680
|
|
|
18681
18681
|
默认为 default
|
|
18682
18682
|
|
|
@@ -18686,7 +18686,7 @@ Defined in: [lib/undici.ts:754](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18686
18686
|
|
|
18687
18687
|
> `optional` **timeout?**: `number`
|
|
18688
18688
|
|
|
18689
|
-
Defined in: [lib/undici.ts:
|
|
18689
|
+
Defined in: [lib/undici.ts:760](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L760)
|
|
18690
18690
|
|
|
18691
18691
|
秒数,默认 300 秒
|
|
18692
18692
|
|
|
@@ -18701,7 +18701,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
18701
18701
|
|
|
18702
18702
|
# Interface: IRequestOptions
|
|
18703
18703
|
|
|
18704
|
-
Defined in: [lib/undici.ts:
|
|
18704
|
+
Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L725)
|
|
18705
18705
|
|
|
18706
18706
|
请求的传入参数选项
|
|
18707
18707
|
|
|
@@ -18711,7 +18711,7 @@ Defined in: [lib/undici.ts:710](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18711
18711
|
|
|
18712
18712
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
18713
18713
|
|
|
18714
|
-
Defined in: [lib/undici.ts:
|
|
18714
|
+
Defined in: [lib/undici.ts:750](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L750)
|
|
18715
18715
|
|
|
18716
18716
|
cookie 托管对象
|
|
18717
18717
|
|
|
@@ -18721,7 +18721,7 @@ cookie 托管对象
|
|
|
18721
18721
|
|
|
18722
18722
|
> `optional` **follow?**: `number`
|
|
18723
18723
|
|
|
18724
|
-
Defined in: [lib/undici.ts:
|
|
18724
|
+
Defined in: [lib/undici.ts:731](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L731)
|
|
18725
18725
|
|
|
18726
18726
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
18727
18727
|
|
|
@@ -18731,7 +18731,7 @@ Defined in: [lib/undici.ts:716](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18731
18731
|
|
|
18732
18732
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18733
18733
|
|
|
18734
|
-
Defined in: [lib/undici.ts:
|
|
18734
|
+
Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L736)
|
|
18735
18735
|
|
|
18736
18736
|
***
|
|
18737
18737
|
|
|
@@ -18739,7 +18739,7 @@ Defined in: [lib/undici.ts:721](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18739
18739
|
|
|
18740
18740
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18741
18741
|
|
|
18742
|
-
Defined in: [lib/undici.ts:
|
|
18742
|
+
Defined in: [lib/undici.ts:733](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L733)
|
|
18743
18743
|
|
|
18744
18744
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18745
18745
|
|
|
@@ -18749,7 +18749,7 @@ Defined in: [lib/undici.ts:718](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18749
18749
|
|
|
18750
18750
|
> `optional` **keep?**: `boolean`
|
|
18751
18751
|
|
|
18752
|
-
Defined in: [lib/undici.ts:
|
|
18752
|
+
Defined in: [lib/undici.ts:746](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L746)
|
|
18753
18753
|
|
|
18754
18754
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
18755
18755
|
|
|
@@ -18759,7 +18759,7 @@ Defined in: [lib/undici.ts:731](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18759
18759
|
|
|
18760
18760
|
> `optional` **local?**: `string`
|
|
18761
18761
|
|
|
18762
|
-
Defined in: [lib/undici.ts:
|
|
18762
|
+
Defined in: [lib/undici.ts:735](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L735)
|
|
18763
18763
|
|
|
18764
18764
|
***
|
|
18765
18765
|
|
|
@@ -18767,7 +18767,7 @@ Defined in: [lib/undici.ts:720](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18767
18767
|
|
|
18768
18768
|
> `optional` **log?**: `boolean`
|
|
18769
18769
|
|
|
18770
|
-
Defined in: [lib/undici.ts:
|
|
18770
|
+
Defined in: [lib/undici.ts:752](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L752)
|
|
18771
18771
|
|
|
18772
18772
|
若有异常写入文件日志,默认为 true
|
|
18773
18773
|
|
|
@@ -18777,7 +18777,7 @@ Defined in: [lib/undici.ts:737](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18777
18777
|
|
|
18778
18778
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
18779
18779
|
|
|
18780
|
-
Defined in: [lib/undici.ts:
|
|
18780
|
+
Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L726)
|
|
18781
18781
|
|
|
18782
18782
|
***
|
|
18783
18783
|
|
|
@@ -18785,7 +18785,7 @@ Defined in: [lib/undici.ts:711](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18785
18785
|
|
|
18786
18786
|
> `optional` **mproxy?**: `object`
|
|
18787
18787
|
|
|
18788
|
-
Defined in: [lib/undici.ts:
|
|
18788
|
+
Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L738)
|
|
18789
18789
|
|
|
18790
18790
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18791
18791
|
|
|
@@ -18813,7 +18813,7 @@ Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18813
18813
|
|
|
18814
18814
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18815
18815
|
|
|
18816
|
-
Defined in: [lib/undici.ts:
|
|
18816
|
+
Defined in: [lib/undici.ts:748](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L748)
|
|
18817
18817
|
|
|
18818
18818
|
复用池名/Agent,默认为 default
|
|
18819
18819
|
|
|
@@ -18823,7 +18823,7 @@ Defined in: [lib/undici.ts:733](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18823
18823
|
|
|
18824
18824
|
> `optional` **save?**: `string`
|
|
18825
18825
|
|
|
18826
|
-
Defined in: [lib/undici.ts:
|
|
18826
|
+
Defined in: [lib/undici.ts:734](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L734)
|
|
18827
18827
|
|
|
18828
18828
|
***
|
|
18829
18829
|
|
|
@@ -18831,7 +18831,7 @@ Defined in: [lib/undici.ts:719](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18831
18831
|
|
|
18832
18832
|
> `optional` **signal?**: `AbortSignal`
|
|
18833
18833
|
|
|
18834
|
-
Defined in: [lib/undici.ts:
|
|
18834
|
+
Defined in: [lib/undici.ts:754](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L754)
|
|
18835
18835
|
|
|
18836
18836
|
请求中止信号
|
|
18837
18837
|
|
|
@@ -18841,7 +18841,7 @@ Defined in: [lib/undici.ts:739](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18841
18841
|
|
|
18842
18842
|
> `optional` **timeout?**: `number`
|
|
18843
18843
|
|
|
18844
|
-
Defined in: [lib/undici.ts:
|
|
18844
|
+
Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L729)
|
|
18845
18845
|
|
|
18846
18846
|
秒数,默认 300 秒
|
|
18847
18847
|
|
|
@@ -18851,7 +18851,7 @@ Defined in: [lib/undici.ts:714](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18851
18851
|
|
|
18852
18852
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
18853
18853
|
|
|
18854
|
-
Defined in: [lib/undici.ts:
|
|
18854
|
+
Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L727)
|
|
18855
18855
|
|
|
18856
18856
|
lib/undici/interfaces/IRproxyOptions.md
|
|
18857
18857
|
---
|
|
@@ -18864,7 +18864,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
18864
18864
|
|
|
18865
18865
|
# Interface: IRproxyOptions
|
|
18866
18866
|
|
|
18867
|
-
Defined in: [lib/undici.ts:
|
|
18867
|
+
Defined in: [lib/undici.ts:773](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L773)
|
|
18868
18868
|
|
|
18869
18869
|
反向代理请求的传入参数选项
|
|
18870
18870
|
|
|
@@ -18874,7 +18874,7 @@ Defined in: [lib/undici.ts:758](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18874
18874
|
|
|
18875
18875
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
18876
18876
|
|
|
18877
|
-
Defined in: [lib/undici.ts:
|
|
18877
|
+
Defined in: [lib/undici.ts:792](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L792)
|
|
18878
18878
|
|
|
18879
18879
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
18880
18880
|
|
|
@@ -18884,7 +18884,7 @@ Defined in: [lib/undici.ts:777](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18884
18884
|
|
|
18885
18885
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18886
18886
|
|
|
18887
|
-
Defined in: [lib/undici.ts:
|
|
18887
|
+
Defined in: [lib/undici.ts:782](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L782)
|
|
18888
18888
|
|
|
18889
18889
|
过滤 header,返回 true 则留下
|
|
18890
18890
|
|
|
@@ -18904,7 +18904,7 @@ Defined in: [lib/undici.ts:767](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18904
18904
|
|
|
18905
18905
|
> `optional` **follow?**: `number`
|
|
18906
18906
|
|
|
18907
|
-
Defined in: [lib/undici.ts:
|
|
18907
|
+
Defined in: [lib/undici.ts:776](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L776)
|
|
18908
18908
|
|
|
18909
18909
|
***
|
|
18910
18910
|
|
|
@@ -18912,7 +18912,7 @@ Defined in: [lib/undici.ts:761](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18912
18912
|
|
|
18913
18913
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18914
18914
|
|
|
18915
|
-
Defined in: [lib/undici.ts:
|
|
18915
|
+
Defined in: [lib/undici.ts:780](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L780)
|
|
18916
18916
|
|
|
18917
18917
|
***
|
|
18918
18918
|
|
|
@@ -18920,7 +18920,7 @@ Defined in: [lib/undici.ts:765](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18920
18920
|
|
|
18921
18921
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18922
18922
|
|
|
18923
|
-
Defined in: [lib/undici.ts:
|
|
18923
|
+
Defined in: [lib/undici.ts:778](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L778)
|
|
18924
18924
|
|
|
18925
18925
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18926
18926
|
|
|
@@ -18930,7 +18930,7 @@ Defined in: [lib/undici.ts:763](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18930
18930
|
|
|
18931
18931
|
> `optional` **local?**: `string`
|
|
18932
18932
|
|
|
18933
|
-
Defined in: [lib/undici.ts:
|
|
18933
|
+
Defined in: [lib/undici.ts:779](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L779)
|
|
18934
18934
|
|
|
18935
18935
|
***
|
|
18936
18936
|
|
|
@@ -18938,7 +18938,7 @@ Defined in: [lib/undici.ts:764](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18938
18938
|
|
|
18939
18939
|
> `optional` **mproxy?**: `object`
|
|
18940
18940
|
|
|
18941
|
-
Defined in: [lib/undici.ts:
|
|
18941
|
+
Defined in: [lib/undici.ts:784](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L784)
|
|
18942
18942
|
|
|
18943
18943
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18944
18944
|
|
|
@@ -18966,7 +18966,7 @@ Defined in: [lib/undici.ts:769](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18966
18966
|
|
|
18967
18967
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
18968
18968
|
|
|
18969
|
-
Defined in: [lib/undici.ts:
|
|
18969
|
+
Defined in: [lib/undici.ts:794](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L794)
|
|
18970
18970
|
|
|
18971
18971
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
18972
18972
|
|
|
@@ -18976,7 +18976,7 @@ Defined in: [lib/undici.ts:779](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18976
18976
|
|
|
18977
18977
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18978
18978
|
|
|
18979
|
-
Defined in: [lib/undici.ts:
|
|
18979
|
+
Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L796)
|
|
18980
18980
|
|
|
18981
18981
|
默认为 default
|
|
18982
18982
|
|
|
@@ -18986,7 +18986,7 @@ Defined in: [lib/undici.ts:781](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18986
18986
|
|
|
18987
18987
|
> `optional` **timeout?**: `number`
|
|
18988
18988
|
|
|
18989
|
-
Defined in: [lib/undici.ts:
|
|
18989
|
+
Defined in: [lib/undici.ts:775](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L775)
|
|
18990
18990
|
|
|
18991
18991
|
秒数,默认 300 秒
|
|
18992
18992
|
|
|
@@ -19475,7 +19475,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19475
19475
|
|
|
19476
19476
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19477
19477
|
|
|
19478
|
-
Defined in: [lib/undici.ts:
|
|
19478
|
+
Defined in: [lib/undici.ts:801](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L801)
|
|
19479
19479
|
|
|
19480
19480
|
http headers
|
|
19481
19481
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.
|
|
9
|
+
export const VER = '9.12.1';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/undici.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as lText from '#kebab/lib/text.js';
|
|
|
6
6
|
import * as lCrypto from '#kebab/lib/crypto.js';
|
|
7
7
|
import * as lCore from '#kebab/lib/core.js';
|
|
8
8
|
import * as lCookie from '#kebab/lib/cookie.js';
|
|
9
|
+
import * as lZlib from '#kebab/lib/zlib.js';
|
|
9
10
|
// --- 自己 ---
|
|
10
11
|
import * as lFd from './undici/formdata.js';
|
|
11
12
|
import * as lRequest from './undici/request.js';
|
|
@@ -620,11 +621,25 @@ export async function rproxy(ctr, route, opt = {}) {
|
|
|
620
621
|
if (rres.headers) {
|
|
621
622
|
filterHeaders(rres.headers, res, opt.filter);
|
|
622
623
|
}
|
|
624
|
+
/** --- 上游已压缩则不再压缩,避免双重压缩导致乱码 --- */
|
|
625
|
+
const upstreamEncoded = !!(rres.headers?.['content-encoding']);
|
|
626
|
+
/** --- 当前的压缩对象 --- */
|
|
627
|
+
const compress = upstreamEncoded ? null : lZlib.createCompress(req.headers['accept-encoding'] ?? '');
|
|
628
|
+
if (compress) {
|
|
629
|
+
res.setHeader('content-encoding', compress.type);
|
|
630
|
+
}
|
|
623
631
|
lCore.writeHead(res, rres.headers?.['http-code'] ?? 200);
|
|
624
632
|
await new Promise((resolve) => {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
633
|
+
if (compress) {
|
|
634
|
+
stream.pipe(compress.compress).pipe(res).on('finish', () => {
|
|
635
|
+
resolve();
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
stream.pipe(res).on('finish', () => {
|
|
640
|
+
resolve();
|
|
641
|
+
});
|
|
642
|
+
}
|
|
628
643
|
});
|
|
629
644
|
return true;
|
|
630
645
|
}
|