@openclaw/discord 2026.6.11 → 2026.6.34
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/action-runtime-api.js +1 -1
- package/dist/{api-4GFMoWu0.js → api-CjnGBhM3.js} +4 -1
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-SsFtZQA6.js → approval-handler.runtime-BWPQrzpP.js} +9 -4
- package/dist/{audit-CAnmyf2A.js → audit-BwJ_2OjL.js} +3 -3
- package/dist/{channel-YA7AbYP3.js → channel-DU4jnQgl.js} +15 -15
- package/dist/{channel-actions-BJ3n5Z1l.js → channel-actions-CwmIqnYN.js} +2 -2
- package/dist/{channel-actions.runtime-D2QTRgZ9.js → channel-actions.runtime-DvpTfaJ4.js} +5 -5
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-B1zDEAR7.js → channel.setup-glZ5Y98a.js} +2 -2
- package/dist/{components-Dm4c_ce6.js → components-j6lTZBsT.js} +1 -1
- package/dist/{conversation-identity-DZ0BD7xO.js → conversation-identity-36FFBwm5.js} +2 -2
- package/dist/{directory-config-BK1OhHa3.js → directory-config-BYMFzL29.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DP3CmwGf.js → directory-live-9JtJCiu8.js} +2 -2
- package/dist/{handle-action.guild-admin-B2cOoU2D.js → handle-action.guild-admin-xxGYrp-I.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{manager.runtime-CPHxr9B3.js → manager.runtime-NxCd-PVt.js} +3 -3
- package/dist/{message-handler-CKaTgBIV.js → message-handler-cizxbaDc.js} +7 -6
- package/dist/{message-handler.preflight--eAiaewz.js → message-handler.preflight-CbD0u7U7.js} +10 -10
- package/dist/{message-handler.process-PhKAmrEd.js → message-handler.process-Do4EM591.js} +10 -10
- package/dist/{message-utils-O1vK3kPu.js → message-utils-CJeAoISH.js} +1 -1
- package/dist/{outbound-adapter-fO_7hbTh.js → outbound-adapter-Dxs6iKEq.js} +62 -131
- package/dist/{pluralkit-B3MzPaPU.js → pluralkit-DI6RYaVj.js} +1 -1
- package/dist/presence-cache-z1N8MbJ3.js +45 -0
- package/dist/{probe-CxnDikWm.js → probe-esE_Oqdm.js} +1 -1
- package/dist/{probe.runtime-DLFkSDVB.js → probe.runtime-C3Atgpvr.js} +1 -1
- package/dist/{provider-BJaJ20MY.js → provider-B-s93q9s.js} +76 -26
- package/dist/{provider-session.runtime-D6xc-60s.js → provider-session.runtime-BKMOqHpd.js} +3 -3
- package/dist/provider.runtime-CaTJrpnl.js +2 -0
- package/dist/{resolve-allowlist-common-BDpBb8dF.js → resolve-allowlist-common-3gB2Gpmm.js} +1 -1
- package/dist/{resolve-channels-iJIjYfRw.js → resolve-channels-B3gQf8QL.js} +3 -3
- package/dist/{resolve-users-_fv1mm1f.js → resolve-users-BO10y5fJ.js} +3 -3
- package/dist/{runtime-ywXByivr.js → runtime-CFlR3L9X.js} +8 -8
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +20 -20
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-CRiBIQEI.js +6 -0
- package/dist/runtime-api.monitor.js +6 -5
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +3 -3
- package/dist/{send-Dc5uQX5H.js → send-JHxfT4Pk.js} +6 -4
- package/dist/{send.components-D4bl20xr.js → send.components-CN35E2Ck.js} +11 -6
- package/dist/{send.outbound-5axvwLkl.js → send.outbound-B-cA1Esv.js} +15 -8
- package/dist/{send.receipt-B21MspvT.js → send.receipt-CGecJDin.js} +10 -1
- package/dist/{send.shared-9082A2sO.js → send.shared-vcbfThdy.js} +107 -16
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{subagent-hooks-NTv6B4up.js → subagent-hooks-20wXhVzZ.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-BzaI1WpN.js → system-events-DR27TE7p.js} +1 -1
- package/dist/{target-resolver-agnOrtOU.js → target-resolver-CDi1gI90.js} +2 -2
- package/dist/targets-C6yd3y8R.js +3 -0
- package/dist/{thread-bindings-DNitaHVh.js → thread-bindings-DU4T6nDo.js} +4 -4
- package/dist/{thread-bindings.discord-api-CjYNuvZa.js → thread-bindings.discord-api-CYkr-3Gj.js} +4 -4
- package/dist/{thread-bindings.manager-PZvJ4TJx.js → thread-bindings.manager-BqWs1UE2.js} +3 -3
- package/dist/{transcripts-source-Bi8N6h5X.js → transcripts-source-D-lBI5ZD.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BdRqXUN3.js → typing-xr05bL-r.js} +1 -1
- package/node_modules/undici/README.md +8 -2
- package/node_modules/undici/docs/docs/api/Agent.md +248 -44
- package/node_modules/undici/docs/docs/api/BalancedPool.md +246 -48
- package/node_modules/undici/docs/docs/api/CacheStorage.md +171 -13
- package/node_modules/undici/docs/docs/api/CacheStore.md +294 -98
- package/node_modules/undici/docs/docs/api/Client.md +369 -179
- package/node_modules/undici/docs/docs/api/ClientStats.md +80 -14
- package/node_modules/undici/docs/docs/api/Connector.md +118 -36
- package/node_modules/undici/docs/docs/api/ContentType.md +65 -25
- package/node_modules/undici/docs/docs/api/Cookies.md +122 -71
- package/node_modules/undici/docs/docs/api/Debug.md +34 -18
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +364 -164
- package/node_modules/undici/docs/docs/api/Dispatcher.md +485 -1102
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +101 -87
- package/node_modules/undici/docs/docs/api/Errors.md +503 -40
- package/node_modules/undici/docs/docs/api/EventSource.md +294 -32
- package/node_modules/undici/docs/docs/api/Fetch.md +680 -31
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +78 -98
- package/node_modules/undici/docs/docs/api/H2CClient.md +298 -176
- package/node_modules/undici/docs/docs/api/Interceptors.md +414 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +333 -314
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +272 -98
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +189 -26
- package/node_modules/undici/docs/docs/api/MockClient.md +151 -33
- package/node_modules/undici/docs/docs/api/MockErrors.md +56 -5
- package/node_modules/undici/docs/docs/api/MockPool.md +321 -258
- package/node_modules/undici/docs/docs/api/Pool.md +235 -43
- package/node_modules/undici/docs/docs/api/PoolStats.md +119 -13
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +179 -160
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +238 -63
- package/node_modules/undici/docs/docs/api/RetryAgent.md +113 -26
- package/node_modules/undici/docs/docs/api/RetryHandler.md +161 -77
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +166 -72
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +264 -542
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +162 -187
- package/node_modules/undici/docs/docs/api/Util.md +68 -11
- package/node_modules/undici/docs/docs/api/WebSocket.md +475 -80
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +100 -32
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +2 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +6 -4
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +9 -7
- package/node_modules/undici/docs/docs/best-practices/proxy.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +10 -8
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +2 -0
- package/node_modules/undici/docs/docs/{GettingStarted.md → getting-started.md} +22 -19
- package/node_modules/undici/docs/docs/index.md +784 -0
- package/node_modules/undici/docs/docs/site.json +125 -0
- package/node_modules/undici/docs/docs/type-map.json +79 -0
- package/node_modules/undici/lib/api/api-request.js +7 -1
- package/node_modules/undici/lib/api/readable.js +47 -2
- package/node_modules/undici/lib/cache/memory-cache-store.js +54 -9
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +7 -1
- package/node_modules/undici/lib/core/errors.js +20 -0
- package/node_modules/undici/lib/core/request.js +14 -3
- package/node_modules/undici/lib/core/util.js +30 -2
- package/node_modules/undici/lib/dispatcher/agent.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h1.js +65 -8
- package/node_modules/undici/lib/dispatcher/client-h2.js +265 -142
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +40 -6
- package/node_modules/undici/lib/global.js +36 -16
- package/node_modules/undici/lib/handler/cache-handler.js +269 -61
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +13 -3
- package/node_modules/undici/lib/handler/redirect-handler.js +6 -2
- package/node_modules/undici/lib/handler/retry-handler.js +87 -23
- package/node_modules/undici/lib/interceptor/cache.js +159 -52
- package/node_modules/undici/lib/interceptor/decompress.js +9 -2
- package/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
- package/node_modules/undici/lib/mock/mock-utils.js +39 -10
- package/node_modules/undici/lib/util/cache.js +372 -68
- package/node_modules/undici/lib/util/date.js +23 -6
- package/node_modules/undici/lib/web/cookies/parse.js +3 -2
- package/node_modules/undici/lib/web/cookies/util.js +79 -9
- package/node_modules/undici/lib/web/eventsource/util.js +1 -1
- package/node_modules/undici/lib/web/fetch/body.js +2 -1
- package/node_modules/undici/lib/web/fetch/constants.js +1 -1
- package/node_modules/undici/lib/web/fetch/index.js +11 -2
- package/node_modules/undici/lib/web/fetch/response.js +1 -3
- package/node_modules/undici/lib/web/fetch/util.js +4 -1
- package/node_modules/undici/package.json +2 -2
- package/node_modules/undici/types/client.d.ts +3 -3
- package/node_modules/undici/types/cookies.d.ts +1 -1
- package/node_modules/undici/types/dispatcher.d.ts +3 -3
- package/node_modules/undici/types/errors.d.ts +10 -0
- package/node_modules/undici/types/handlers.d.ts +2 -0
- package/node_modules/undici/types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici/types/proxy-agent.d.ts +7 -0
- package/npm-shrinkwrap.json +7 -7
- package/package.json +5 -5
- package/dist/gateway-registry-DPxmW0Db.js +0 -74
- package/dist/provider.runtime-jNlHxUSW.js +0 -2
- package/dist/runtime-api.monitor-Bb5AaRzg.js +0 -6
- package/dist/targets-ClUPljCU.js +0 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sidebar": [
|
|
3
|
+
{
|
|
4
|
+
"groupName": "Documentation",
|
|
5
|
+
"items": [
|
|
6
|
+
{ "link": "/", "label": "Home" },
|
|
7
|
+
{ "link": "/getting-started", "label": "Getting Started" }
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"groupName": "API",
|
|
12
|
+
"items": [
|
|
13
|
+
{
|
|
14
|
+
"label": "Core",
|
|
15
|
+
"items": [
|
|
16
|
+
{ "link": "/api/Dispatcher", "label": "Dispatcher" },
|
|
17
|
+
{ "link": "/api/Client", "label": "Client" },
|
|
18
|
+
{ "link": "/api/H2CClient", "label": "H2CClient" },
|
|
19
|
+
{ "link": "/api/Pool", "label": "Pool" },
|
|
20
|
+
{ "link": "/api/BalancedPool", "label": "BalancedPool" },
|
|
21
|
+
{ "link": "/api/RoundRobinPool", "label": "RoundRobinPool" },
|
|
22
|
+
{ "link": "/api/Agent", "label": "Agent" },
|
|
23
|
+
{ "link": "/api/PoolStats", "label": "PoolStats" },
|
|
24
|
+
{ "link": "/api/Connector", "label": "Connector" }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"label": "Proxy & Agents",
|
|
29
|
+
"items": [
|
|
30
|
+
{ "link": "/api/ProxyAgent", "label": "ProxyAgent" },
|
|
31
|
+
{
|
|
32
|
+
"link": "/api/EnvHttpProxyAgent",
|
|
33
|
+
"label": "EnvHttpProxyAgent"
|
|
34
|
+
},
|
|
35
|
+
{ "link": "/api/Socks5ProxyAgent", "label": "Socks5ProxyAgent" },
|
|
36
|
+
{ "link": "/api/RetryAgent", "label": "RetryAgent" }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"label": "Web Standards",
|
|
41
|
+
"items": [
|
|
42
|
+
{ "link": "/api/Fetch", "label": "Fetch" },
|
|
43
|
+
{ "link": "/api/EventSource", "label": "EventSource" },
|
|
44
|
+
{ "link": "/api/WebSocket", "label": "WebSocket" },
|
|
45
|
+
{ "link": "/api/Cookies", "label": "Cookies" },
|
|
46
|
+
{ "link": "/api/CacheStorage", "label": "CacheStorage" },
|
|
47
|
+
{ "link": "/api/ContentType", "label": "MIME Type Parsing" }
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"label": "Mocking",
|
|
52
|
+
"items": [
|
|
53
|
+
{ "link": "/api/MockClient", "label": "MockClient" },
|
|
54
|
+
{ "link": "/api/MockPool", "label": "MockPool" },
|
|
55
|
+
{ "link": "/api/MockAgent", "label": "MockAgent" },
|
|
56
|
+
{ "link": "/api/SnapshotAgent", "label": "SnapshotAgent" },
|
|
57
|
+
{ "link": "/api/MockCallHistory", "label": "MockCallHistory" },
|
|
58
|
+
{
|
|
59
|
+
"link": "/api/MockCallHistoryLog",
|
|
60
|
+
"label": "MockCallHistoryLog"
|
|
61
|
+
},
|
|
62
|
+
{ "link": "/api/MockErrors", "label": "MockErrors" }
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"label": "Interceptors",
|
|
67
|
+
"items": [
|
|
68
|
+
{ "link": "/api/Interceptors", "label": "Interceptors" }
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"label": "Handlers",
|
|
73
|
+
"items": [
|
|
74
|
+
{ "link": "/api/RedirectHandler", "label": "RedirectHandler" },
|
|
75
|
+
{ "link": "/api/RetryHandler", "label": "RetryHandler" }
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"label": "Diagnostics & Utilities",
|
|
80
|
+
"items": [
|
|
81
|
+
{ "link": "/api/Errors", "label": "Errors" },
|
|
82
|
+
{
|
|
83
|
+
"link": "/api/DiagnosticsChannel",
|
|
84
|
+
"label": "Diagnostics Channel Support"
|
|
85
|
+
},
|
|
86
|
+
{ "link": "/api/Debug", "label": "Debug" },
|
|
87
|
+
{ "link": "/api/Util", "label": "Util" },
|
|
88
|
+
{
|
|
89
|
+
"link": "/api/GlobalInstallation",
|
|
90
|
+
"label": "Global Installation"
|
|
91
|
+
},
|
|
92
|
+
{ "link": "/api/api-lifecycle", "label": "API Lifecycle" }
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"groupName": "Best Practices",
|
|
99
|
+
"items": [
|
|
100
|
+
{
|
|
101
|
+
"link": "/best-practices/undici-vs-builtin-fetch",
|
|
102
|
+
"label": "Undici vs. Built-in Fetch"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"link": "/best-practices/migrating-from-v7-to-v8",
|
|
106
|
+
"label": "Migrating from Undici 7 to 8"
|
|
107
|
+
},
|
|
108
|
+
{ "link": "/best-practices/proxy", "label": "Proxy" },
|
|
109
|
+
{
|
|
110
|
+
"link": "/best-practices/client-certificate",
|
|
111
|
+
"label": "Client Certificate"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"link": "/best-practices/writing-tests",
|
|
115
|
+
"label": "Writing Tests"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"link": "/best-practices/mocking-request",
|
|
119
|
+
"label": "Mocking Request"
|
|
120
|
+
},
|
|
121
|
+
{ "link": "/best-practices/crawling", "label": "Crawling" }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AbortError": "/api/Errors.md#class-aborterror",
|
|
3
|
+
"Agent": "/api/Agent.md#class-agent",
|
|
4
|
+
"AgentDispatchOptions": "/api/Agent.md#agentdispatchoptions-handler",
|
|
5
|
+
"AgentOptions": "/api/Agent.md#new-agentoptions",
|
|
6
|
+
"BalancedPool": "/api/BalancedPool.md#class-balancedpool",
|
|
7
|
+
"BalancedPoolOptions": "/api/BalancedPool.md#parameter-balancedpooloptions",
|
|
8
|
+
"BodyMixin": "/api/Fetch.md#new-formdata",
|
|
9
|
+
"Buffer": "https://nodejs.org/api/buffer.html#class-buffer",
|
|
10
|
+
"BuildOptions": "/api/Connector.md#buildconnectoroptions",
|
|
11
|
+
"CacheKey": "/api/CacheStore.md#cachekey",
|
|
12
|
+
"CacheStore": "/api/CacheStore.md#new-memorycachestoreoptions",
|
|
13
|
+
"CacheValue": "/api/CacheStore.md#cachevalue",
|
|
14
|
+
"ClientDestroyedError": "/api/Errors.md#class-clientdestroyederror",
|
|
15
|
+
"ClientOptions": "/api/Client.md#new-clienturl-options",
|
|
16
|
+
"ClientStats": "/api/ClientStats.md#class-clientstats",
|
|
17
|
+
"ConnectOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
18
|
+
"Cookie": "/api/Cookies.md#cookie",
|
|
19
|
+
"DispatchController": "/api/Dispatcher.md#class-dispatcher",
|
|
20
|
+
"DispatchHandler": "/api/Dispatcher.md#class-dispatcher",
|
|
21
|
+
"DispatchOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
22
|
+
"Dispatcher": "/api/Dispatcher.md#class-dispatcher",
|
|
23
|
+
"Duplex": "https://nodejs.org/api/stream.html#class-streamduplex",
|
|
24
|
+
"EnvHttpProxyAgent": "/api/EnvHttpProxyAgent.md#class-envhttpproxyagent",
|
|
25
|
+
"EnvHttpProxyAgentOptions": "/api/EnvHttpProxyAgent.md#new-envhttpproxyagentoptions",
|
|
26
|
+
"EventEmitter": "https://nodejs.org/api/events.html#class-eventemitter",
|
|
27
|
+
"GetResult": "/api/CacheStore.md#getresult",
|
|
28
|
+
"H2CClientOptions": "/api/H2CClient.md#new-h2cclienturl-options",
|
|
29
|
+
"HeadersInit": "https://developer.mozilla.org/docs/Web/API/Headers/Headers",
|
|
30
|
+
"InvalidArgumentError": "/api/Errors.md#class-invalidargumenterror",
|
|
31
|
+
"Iterable": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols",
|
|
32
|
+
"MaxOriginsReachedError": "/api/Errors.md#class-maxoriginsreachederror",
|
|
33
|
+
"MockAgent": "/api/MockAgent.md#class-mockagent",
|
|
34
|
+
"MockAgentOptions": "/api/MockAgent.md#parameter-mockagentoptions",
|
|
35
|
+
"MockCallHistory": "/api/MockCallHistory.md#class-mockcallhistory",
|
|
36
|
+
"MockCallHistoryLog": "/api/MockCallHistoryLog.md#class-mockcallhistorylog",
|
|
37
|
+
"MockClient": "/api/MockClient.md#class-mockclient",
|
|
38
|
+
"MockClientOptions": "/api/MockClient.md#parameter-mockclientoptions",
|
|
39
|
+
"MockInterceptor": "/api/MockPool.md#return-mockinterceptor",
|
|
40
|
+
"MockInterceptor.Options": "/api/MockPool.md#parameter-mockpoolinterceptoptions",
|
|
41
|
+
"MockPool": "/api/MockPool.md#class-mockpool",
|
|
42
|
+
"MockPoolInterceptOptions": "/api/MockPool.md#parameter-mockpoolinterceptoptions",
|
|
43
|
+
"MockPoolOptions": "/api/MockPool.md#parameter-mockpooloptions",
|
|
44
|
+
"MockResponseOptions": "/api/MockPool.md#parameter-mockresponseoptions",
|
|
45
|
+
"MockScope": "/api/MockPool.md#return-mockscope",
|
|
46
|
+
"PendingInterceptor": "/api/MockAgent.md#new-mockagentoptions",
|
|
47
|
+
"PipelineOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
48
|
+
"Pool": "/api/Pool.md#class-pool",
|
|
49
|
+
"PoolOptions": "/api/Pool.md#new-poolurl-options",
|
|
50
|
+
"PoolStats": "/api/PoolStats.md#class-poolstats",
|
|
51
|
+
"ProxyAgent": "/api/ProxyAgent.md#class-proxyagent",
|
|
52
|
+
"ProxyAgentOptions": "/api/ProxyAgent.md#new-proxyagentoptions",
|
|
53
|
+
"Readable": "https://nodejs.org/api/stream.html#class-streamreadable",
|
|
54
|
+
"Record": "https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type",
|
|
55
|
+
"RequestInit": "/api/Fetch.md#new-formdata",
|
|
56
|
+
"RequestOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
57
|
+
"ResponseInit": "/api/Fetch.md#new-formdata",
|
|
58
|
+
"RetryContext": "/api/RetryHandler.md#retrycontext",
|
|
59
|
+
"RetryHandler": "/api/RetryHandler.md#class-retryhandler",
|
|
60
|
+
"RetryHandlers": "/api/RetryHandler.md#parameter-retryhandlers",
|
|
61
|
+
"RetryOptions": "/api/RetryHandler.md#retryoptions",
|
|
62
|
+
"RetryState": "/api/RetryHandler.md#retrystate",
|
|
63
|
+
"RoundRobinPoolOptions": "/api/RoundRobinPool.md#parameter-roundrobinpooloptions",
|
|
64
|
+
"SnapshotRecorder": "/api/SnapshotAgent.md#new-snapshotagentoptions",
|
|
65
|
+
"Socket": "https://nodejs.org/api/net.html#class-netsocket",
|
|
66
|
+
"SocketInfo": "/api/Errors.md#new-requestretryerrormessage-code-options",
|
|
67
|
+
"StreamOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
68
|
+
"TLSSocket": "https://nodejs.org/api/tls.html#class-tlstlssocket",
|
|
69
|
+
"UndiciError": "/api/Errors.md#class-undicierror",
|
|
70
|
+
"UndiciHeaders": "/api/Dispatcher.md#class-dispatcher",
|
|
71
|
+
"UpgradeOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
72
|
+
"UrlObject": "/index.md#urlobject",
|
|
73
|
+
"WebSocketInit": "/api/WebSocket.md#new-websocketurl-protocols",
|
|
74
|
+
"WebSocketStreamOptions": "/api/WebSocket.md#new-websocketurl-protocols",
|
|
75
|
+
"Writable": "https://nodejs.org/api/stream.html#class-streamwritable",
|
|
76
|
+
"buildConnector.BuildOptions": "/api/Connector.md#buildconnectoroptions",
|
|
77
|
+
"net.Socket": "https://nodejs.org/api/net.html#class-netsocket",
|
|
78
|
+
"stream.Readable": "https://nodejs.org/api/stream.html#class-streamreadable"
|
|
79
|
+
}
|
|
@@ -66,7 +66,13 @@ class RequestHandler extends AsyncResource {
|
|
|
66
66
|
this.removeAbortListener = util.addAbortListener(signal, () => {
|
|
67
67
|
this.reason = signal.reason ?? new RequestAbortedError()
|
|
68
68
|
if (this.res) {
|
|
69
|
-
|
|
69
|
+
// Null the reference before destroying, mirroring onResponseError, so
|
|
70
|
+
// that chunks flushed after the abort (e.g. an async decompressor
|
|
71
|
+
// flush) are dropped by the `!this.res` guard in onResponseData
|
|
72
|
+
// instead of being pushed into the torn-down stream.
|
|
73
|
+
const res = this.res
|
|
74
|
+
this.res = null
|
|
75
|
+
util.destroy(res.on('error', noop), this.reason)
|
|
70
76
|
} else if (this.abort) {
|
|
71
77
|
this.abort(this.reason)
|
|
72
78
|
}
|
|
@@ -15,6 +15,7 @@ const kContentType = Symbol('kContentType')
|
|
|
15
15
|
const kContentLength = Symbol('kContentLength')
|
|
16
16
|
const kUsed = Symbol('kUsed')
|
|
17
17
|
const kBytesRead = Symbol('kBytesRead')
|
|
18
|
+
const kPreservedBuffer = Symbol('kPreservedBuffer')
|
|
18
19
|
|
|
19
20
|
const noop = () => {}
|
|
20
21
|
|
|
@@ -325,7 +326,37 @@ class BodyReadable extends Readable {
|
|
|
325
326
|
*/
|
|
326
327
|
setEncoding (encoding) {
|
|
327
328
|
if (Buffer.isEncoding(encoding)) {
|
|
328
|
-
|
|
329
|
+
// Preserve raw Buffer chunks for the consume path (body.text(),
|
|
330
|
+
// body.json(), etc.) before super.setEncoding() replaces them
|
|
331
|
+
// with decoded strings. Without this, the consume path would
|
|
332
|
+
// lose access to the original bytes — some of which may be held
|
|
333
|
+
// by the decoder for incomplete multi-byte sequences, and the
|
|
334
|
+
// rest converted to strings that can't be safely concatenated
|
|
335
|
+
// byte-wise.
|
|
336
|
+
const state = this._readableState
|
|
337
|
+
const buffer = state.buffer
|
|
338
|
+
if (buffer && state.length > 0) {
|
|
339
|
+
const bufferIndex = state.bufferIndex ?? 0
|
|
340
|
+
const preserved = []
|
|
341
|
+
const source = typeof buffer.slice === 'function'
|
|
342
|
+
? buffer.slice(bufferIndex)
|
|
343
|
+
: buffer
|
|
344
|
+
for (const data of source) {
|
|
345
|
+
if (Buffer.isBuffer(data)) {
|
|
346
|
+
preserved.push(data)
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (preserved.length > 0) {
|
|
350
|
+
this[kPreservedBuffer] = (this[kPreservedBuffer] || []).concat(preserved)
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Delegate to Node.js Readable.setEncoding() which initializes a
|
|
355
|
+
// StringDecoder and re-encodes already-buffered chunks. This properly
|
|
356
|
+
// handles multi-byte sequences split at chunk boundaries for the
|
|
357
|
+
// for-await / on('data') paths. Without this, Node.js uses
|
|
358
|
+
// buf.toString(encoding) on each chunk, producing U+FFFD for split chars.
|
|
359
|
+
super.setEncoding(encoding)
|
|
329
360
|
}
|
|
330
361
|
return this
|
|
331
362
|
}
|
|
@@ -433,7 +464,17 @@ function consumeStart (consume) {
|
|
|
433
464
|
|
|
434
465
|
const { _readableState: state } = consume.stream
|
|
435
466
|
|
|
436
|
-
|
|
467
|
+
// If setEncoding() was called, state.buffer may contain decoded strings
|
|
468
|
+
// (which would break Buffer.concat in chunksDecode). Use the preserved
|
|
469
|
+
// raw Buffers (saved before super.setEncoding() in setEncoding()) for
|
|
470
|
+
// byte-level accurate consumption. Otherwise read from state.buffer.
|
|
471
|
+
const preserved = consume.stream[kPreservedBuffer]
|
|
472
|
+
if (preserved && preserved.length > 0) {
|
|
473
|
+
for (const chunk of preserved) {
|
|
474
|
+
consumePush(consume, chunk)
|
|
475
|
+
}
|
|
476
|
+
consume.stream[kPreservedBuffer] = null
|
|
477
|
+
} else if (state.bufferIndex) {
|
|
437
478
|
const start = state.bufferIndex
|
|
438
479
|
const end = state.buffer.length
|
|
439
480
|
for (let n = start; n < end; n++) {
|
|
@@ -546,6 +587,10 @@ function consumeEnd (consume, encoding) {
|
|
|
546
587
|
* @returns {void}
|
|
547
588
|
*/
|
|
548
589
|
function consumePush (consume, chunk) {
|
|
590
|
+
if (consume.body === null) {
|
|
591
|
+
return
|
|
592
|
+
}
|
|
593
|
+
|
|
549
594
|
consume.length += chunk.length
|
|
550
595
|
consume.body.push(chunk)
|
|
551
596
|
}
|
|
@@ -218,17 +218,62 @@ class MemoryCacheStore extends EventEmitter {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
function findEntry (key, entries, now) {
|
|
221
|
-
|
|
222
|
-
entry
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
for (let i = 0; i < entries.length; i++) {
|
|
222
|
+
const entry = entries[i]
|
|
223
|
+
if (
|
|
224
|
+
entry.deleteAt > now &&
|
|
225
|
+
entry.method === key.method &&
|
|
226
|
+
varyMatches(key, entry)
|
|
227
|
+
) {
|
|
228
|
+
return entry
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function varyMatches (key, entry) {
|
|
234
|
+
if (entry.vary == null) {
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
for (const headerName in entry.vary) {
|
|
239
|
+
if (Object.hasOwn(entry.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry.vary[headerName])) {
|
|
240
|
+
return false
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return true
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @param {string|string[]|null|undefined} lhs
|
|
249
|
+
* @param {string|string[]|null|undefined} rhs
|
|
250
|
+
* @returns {boolean}
|
|
251
|
+
*/
|
|
252
|
+
function headerValueEquals (lhs, rhs) {
|
|
253
|
+
if (lhs == null && rhs == null) {
|
|
254
|
+
return true
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if ((lhs == null && rhs != null) ||
|
|
258
|
+
(lhs != null && rhs == null)) {
|
|
259
|
+
return false
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
263
|
+
if (lhs.length !== rhs.length) {
|
|
264
|
+
return false
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
268
|
+
if (lhs[i] !== rhs[i]) {
|
|
269
|
+
return false
|
|
227
270
|
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return true
|
|
274
|
+
}
|
|
228
275
|
|
|
229
|
-
|
|
230
|
-
}))
|
|
231
|
-
))
|
|
276
|
+
return lhs === rhs
|
|
232
277
|
}
|
|
233
278
|
|
|
234
279
|
module.exports = MemoryCacheStore
|
|
@@ -456,7 +456,13 @@ function headerValueEquals (lhs, rhs) {
|
|
|
456
456
|
return false
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
460
|
+
if (lhs[i] !== rhs[i]) {
|
|
461
|
+
return false
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return true
|
|
460
466
|
}
|
|
461
467
|
|
|
462
468
|
return lhs === rhs
|
|
@@ -403,6 +403,25 @@ class SecureProxyConnectionError extends UndiciError {
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
const kProxyConnectionError = Symbol.for('undici.error.UND_ERR_PRX_CONN')
|
|
407
|
+
class ProxyConnectionError extends UndiciError {
|
|
408
|
+
constructor (cause, message, options = {}) {
|
|
409
|
+
super(message, { cause, ...options })
|
|
410
|
+
this.name = 'ProxyConnectionError'
|
|
411
|
+
this.message = message || 'Proxy Connection failed'
|
|
412
|
+
this.code = 'UND_ERR_PRX_CONN'
|
|
413
|
+
this.cause = cause
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
static [Symbol.hasInstance] (instance) {
|
|
417
|
+
return instance && instance[kProxyConnectionError] === true
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
get [kProxyConnectionError] () {
|
|
421
|
+
return true
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
406
425
|
const kMaxOriginsReachedError = Symbol.for('undici.error.UND_ERR_MAX_ORIGINS_REACHED')
|
|
407
426
|
class MaxOriginsReachedError extends UndiciError {
|
|
408
427
|
constructor (message) {
|
|
@@ -471,6 +490,7 @@ module.exports = {
|
|
|
471
490
|
RequestRetryError,
|
|
472
491
|
ResponseError,
|
|
473
492
|
SecureProxyConnectionError,
|
|
493
|
+
ProxyConnectionError,
|
|
474
494
|
MaxOriginsReachedError,
|
|
475
495
|
Socks5ProxyError,
|
|
476
496
|
MessageSizeExceededError
|
|
@@ -173,7 +173,7 @@ class Request {
|
|
|
173
173
|
|
|
174
174
|
this.method = method
|
|
175
175
|
|
|
176
|
-
this.typeOfService = typeOfService
|
|
176
|
+
this.typeOfService = typeOfService
|
|
177
177
|
|
|
178
178
|
this.abort = null
|
|
179
179
|
|
|
@@ -225,7 +225,7 @@ class Request {
|
|
|
225
225
|
this.protocol = getProtocolFromUrlString(origin)
|
|
226
226
|
|
|
227
227
|
this.idempotent = idempotent == null
|
|
228
|
-
? method === 'HEAD' || method === 'GET'
|
|
228
|
+
? method === 'HEAD' || method === 'GET' || method === 'QUERY'
|
|
229
229
|
: idempotent
|
|
230
230
|
|
|
231
231
|
this.blocking = blocking ?? this.method !== 'HEAD'
|
|
@@ -472,7 +472,13 @@ function processHeader (request, key, val) {
|
|
|
472
472
|
} else if (typeof val[i] === 'object') {
|
|
473
473
|
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
474
474
|
} else {
|
|
475
|
-
|
|
475
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
476
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
477
|
+
const str = `${val[i]}`
|
|
478
|
+
if (!isValidHeaderValue(str)) {
|
|
479
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
480
|
+
}
|
|
481
|
+
arr.push(str)
|
|
476
482
|
}
|
|
477
483
|
}
|
|
478
484
|
val = arr
|
|
@@ -483,7 +489,12 @@ function processHeader (request, key, val) {
|
|
|
483
489
|
} else if (val === null) {
|
|
484
490
|
val = ''
|
|
485
491
|
} else {
|
|
492
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
493
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
486
494
|
val = `${val}`
|
|
495
|
+
if (!isValidHeaderValue(val)) {
|
|
496
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
497
|
+
}
|
|
487
498
|
}
|
|
488
499
|
|
|
489
500
|
if (headerName === 'host') {
|
|
@@ -370,7 +370,12 @@ function destroy (stream, err) {
|
|
|
370
370
|
stream.socket = null
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
try {
|
|
374
|
+
stream.destroy(err)
|
|
375
|
+
} catch {
|
|
376
|
+
// stream.destroy may throw on managed sockets (e.g., http2).
|
|
377
|
+
// Silently ignore — the socket lifecycle is handled by the subsystem.
|
|
378
|
+
}
|
|
374
379
|
} else if (err) {
|
|
375
380
|
queueMicrotask(() => {
|
|
376
381
|
stream.emit('error', err)
|
|
@@ -919,11 +924,32 @@ function onConnectTimeout (socket, opts) {
|
|
|
919
924
|
destroy(socket, new ConnectTimeoutError(message))
|
|
920
925
|
}
|
|
921
926
|
|
|
927
|
+
let lastUrlString = null
|
|
928
|
+
let lastProtocol = null
|
|
929
|
+
|
|
922
930
|
/**
|
|
923
931
|
* @param {string} urlString
|
|
924
932
|
* @returns {string}
|
|
925
933
|
*/
|
|
926
934
|
function getProtocolFromUrlString (urlString) {
|
|
935
|
+
// Requests are typically dispatched against the same origin over and over,
|
|
936
|
+
// so cache the last (urlString, protocol) pair to skip re-parsing.
|
|
937
|
+
if (urlString === lastUrlString) {
|
|
938
|
+
return lastProtocol
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
const protocol = getProtocolFromUrlStringSlow(urlString)
|
|
942
|
+
lastUrlString = urlString
|
|
943
|
+
lastProtocol = protocol
|
|
944
|
+
|
|
945
|
+
return protocol
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* @param {string} urlString
|
|
950
|
+
* @returns {string}
|
|
951
|
+
*/
|
|
952
|
+
function getProtocolFromUrlStringSlow (urlString) {
|
|
927
953
|
if (
|
|
928
954
|
urlString[0] === 'h' &&
|
|
929
955
|
urlString[1] === 't' &&
|
|
@@ -960,7 +986,9 @@ const normalizedMethodRecordsBase = {
|
|
|
960
986
|
post: 'POST',
|
|
961
987
|
POST: 'POST',
|
|
962
988
|
put: 'PUT',
|
|
963
|
-
PUT: 'PUT'
|
|
989
|
+
PUT: 'PUT',
|
|
990
|
+
query: 'QUERY',
|
|
991
|
+
QUERY: 'QUERY'
|
|
964
992
|
}
|
|
965
993
|
|
|
966
994
|
const normalizedMethodRecords = {
|
|
@@ -107,15 +107,15 @@ class Agent extends DispatcherBase {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
let hasOrigin = false
|
|
110
|
-
for (const
|
|
111
|
-
if (
|
|
110
|
+
for (const k of this[kClients].keys()) {
|
|
111
|
+
if (k === origin || k === `${origin}#http1-only`) {
|
|
112
112
|
hasOrigin = true
|
|
113
113
|
break
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (!hasOrigin) {
|
|
118
|
-
this[kOrigins].delete(
|
|
118
|
+
this[kOrigins].delete(origin)
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
RequestContentLengthMismatchError,
|
|
11
11
|
ResponseContentLengthMismatchError,
|
|
12
12
|
RequestAbortedError,
|
|
13
|
+
InvalidArgumentError,
|
|
13
14
|
HeadersTimeoutError,
|
|
14
15
|
HeadersOverflowError,
|
|
15
16
|
SocketError,
|
|
@@ -60,6 +61,7 @@ const removeAllListeners = util.removeAllListeners
|
|
|
60
61
|
const kIdleSocketValidation = Symbol('kIdleSocketValidation')
|
|
61
62
|
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
|
|
62
63
|
const kSocketUsed = Symbol('kSocketUsed')
|
|
64
|
+
const kTypeOfService = Symbol('kTypeOfService')
|
|
63
65
|
|
|
64
66
|
let extractBody
|
|
65
67
|
|
|
@@ -377,6 +379,29 @@ class Parser {
|
|
|
377
379
|
|
|
378
380
|
const { llhttp } = this
|
|
379
381
|
|
|
382
|
+
// The peer closed the connection. If the body parser was paused by
|
|
383
|
+
// backpressure we must finish parsing before signalling EOF, otherwise
|
|
384
|
+
// llhttp_finish() would crash (it used to assert !paused) or report a
|
|
385
|
+
// half-parsed message. Backpressure is advisory here: onData keeps buffering
|
|
386
|
+
// delivered bytes into the response stream, so resume across pauses and
|
|
387
|
+
// drain whatever is still buffered on the socket. A Content-Length/chunked
|
|
388
|
+
// body reaches on_message_complete during execute(); an EOF-delimited body
|
|
389
|
+
// stays paused (its length is unknown) and is completed by llhttp_finish().
|
|
390
|
+
if (this.paused) {
|
|
391
|
+
let data
|
|
392
|
+
do {
|
|
393
|
+
llhttp.llhttp_resume(this.ptr)
|
|
394
|
+
this.paused = false
|
|
395
|
+
data = this.socket.read() || EMPTY_BUF
|
|
396
|
+
this.execute(data)
|
|
397
|
+
} while (this.paused && data.length > 0)
|
|
398
|
+
|
|
399
|
+
if (this.paused) {
|
|
400
|
+
llhttp.llhttp_resume(this.ptr)
|
|
401
|
+
this.paused = false
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
380
405
|
let ret
|
|
381
406
|
|
|
382
407
|
try {
|
|
@@ -1027,7 +1052,7 @@ function onSocketClose () {
|
|
|
1027
1052
|
|
|
1028
1053
|
function clearIdleSocketValidation (socket) {
|
|
1029
1054
|
if (socket[kIdleSocketValidationTimeout]) {
|
|
1030
|
-
|
|
1055
|
+
clearImmediate(socket[kIdleSocketValidationTimeout])
|
|
1031
1056
|
socket[kIdleSocketValidationTimeout] = null
|
|
1032
1057
|
}
|
|
1033
1058
|
|
|
@@ -1036,14 +1061,14 @@ function clearIdleSocketValidation (socket) {
|
|
|
1036
1061
|
|
|
1037
1062
|
function scheduleIdleSocketValidation (client, socket) {
|
|
1038
1063
|
socket[kIdleSocketValidation] = 1
|
|
1039
|
-
socket[kIdleSocketValidationTimeout] =
|
|
1064
|
+
socket[kIdleSocketValidationTimeout] = setImmediate(() => {
|
|
1040
1065
|
socket[kIdleSocketValidationTimeout] = null
|
|
1041
1066
|
socket[kIdleSocketValidation] = 2
|
|
1042
1067
|
|
|
1043
1068
|
if (client[kSocket] === socket && !socket.destroyed) {
|
|
1044
1069
|
client[kResume]()
|
|
1045
1070
|
}
|
|
1046
|
-
}
|
|
1071
|
+
})
|
|
1047
1072
|
socket[kIdleSocketValidationTimeout].unref?.()
|
|
1048
1073
|
}
|
|
1049
1074
|
|
|
@@ -1111,6 +1136,32 @@ function shouldSendContentLength (method) {
|
|
|
1111
1136
|
return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
|
|
1112
1137
|
}
|
|
1113
1138
|
|
|
1139
|
+
function setTypeOfService (socket, request) {
|
|
1140
|
+
if (typeof socket.setTypeOfService !== 'function') {
|
|
1141
|
+
return
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
const typeOfService = request.typeOfService
|
|
1145
|
+
|
|
1146
|
+
if (typeOfService === undefined) {
|
|
1147
|
+
return
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
const currentTypeOfService = socket[kTypeOfService]
|
|
1151
|
+
|
|
1152
|
+
if (currentTypeOfService === typeOfService) {
|
|
1153
|
+
return
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
try {
|
|
1157
|
+
socket.setTypeOfService(typeOfService)
|
|
1158
|
+
socket[kTypeOfService] = typeOfService
|
|
1159
|
+
} catch {
|
|
1160
|
+
// QoS marking is best-effort. setTypeOfService() can throw synchronously on
|
|
1161
|
+
// some platforms depending on socket state, but that must not abort the request.
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1114
1165
|
/**
|
|
1115
1166
|
* @param {import('./client.js')} client
|
|
1116
1167
|
* @param {import('../core/request.js')} request
|
|
@@ -1150,8 +1201,16 @@ function writeH1 (client, request) {
|
|
|
1150
1201
|
}
|
|
1151
1202
|
body = bodyStream.stream
|
|
1152
1203
|
contentLength = bodyStream.length
|
|
1153
|
-
} else if (util.isBlobLike(body) && request.contentType == null
|
|
1154
|
-
|
|
1204
|
+
} else if (util.isBlobLike(body) && request.contentType == null) {
|
|
1205
|
+
const contentType = body.type
|
|
1206
|
+
if (contentType) {
|
|
1207
|
+
const contentTypeValue = `${contentType}`
|
|
1208
|
+
if (!util.isValidHeaderValue(contentTypeValue)) {
|
|
1209
|
+
util.errorRequest(client, request, new InvalidArgumentError('invalid content-type header'))
|
|
1210
|
+
return false
|
|
1211
|
+
}
|
|
1212
|
+
headers.push('content-type', contentTypeValue)
|
|
1213
|
+
}
|
|
1155
1214
|
}
|
|
1156
1215
|
|
|
1157
1216
|
if (body && typeof body.read === 'function') {
|
|
@@ -1242,9 +1301,7 @@ function writeH1 (client, request) {
|
|
|
1242
1301
|
socket[kBlocking] = true
|
|
1243
1302
|
}
|
|
1244
1303
|
|
|
1245
|
-
|
|
1246
|
-
socket.setTypeOfService(request.typeOfService)
|
|
1247
|
-
}
|
|
1304
|
+
setTypeOfService(socket, request)
|
|
1248
1305
|
|
|
1249
1306
|
let header = `${method} ${path} HTTP/1.1\r\n`
|
|
1250
1307
|
|