@psnext/slingcli 3.5.20261007-3 → 3.5.20261026-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.
Files changed (453) hide show
  1. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +12 -3
  2. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
  3. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +12 -3
  4. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
  5. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
  6. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
  7. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
  8. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  9. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  10. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  11. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  12. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
  13. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  14. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  15. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  16. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  17. package/node_modules/@aws-sdk/core/package.json +4 -4
  18. package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
  19. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  20. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  21. package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
  22. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  23. package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
  24. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
  25. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
  26. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +5 -5
  27. package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
  28. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
  29. package/node_modules/@aws-sdk/eventstream-handler-node/package.json +3 -3
  30. package/node_modules/@aws-sdk/middleware-eventstream/package.json +3 -3
  31. package/node_modules/@aws-sdk/middleware-websocket/package.json +5 -5
  32. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +11 -1
  33. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +6 -1
  34. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +6 -1
  35. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +13 -1
  36. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +9 -1
  37. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/models/CognitoIdentityServiceException.js +1 -0
  38. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/models/errors.js +9 -0
  39. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/SigninServiceException.js +1 -0
  40. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/errors.js +4 -0
  41. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/SSOServiceException.js +1 -0
  42. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/errors.js +4 -0
  43. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/models/SSOOIDCServiceException.js +1 -0
  44. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/models/errors.js +11 -0
  45. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/models/STSServiceException.js +1 -0
  46. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/models/errors.js +7 -0
  47. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentityClient.d.ts +2 -1
  48. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/models/CognitoIdentityServiceException.d.ts +1 -0
  49. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/models/errors.d.ts +9 -0
  50. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +2 -1
  51. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/SigninServiceException.d.ts +1 -0
  52. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/errors.d.ts +4 -0
  53. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSOClient.d.ts +2 -1
  54. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/models/SSOServiceException.d.ts +1 -0
  55. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/models/errors.d.ts +4 -0
  56. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDCClient.d.ts +2 -1
  57. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/models/SSOOIDCServiceException.d.ts +1 -0
  58. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/models/errors.d.ts +11 -0
  59. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +2 -1
  60. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/STSServiceException.d.ts +1 -0
  61. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/errors.d.ts +7 -0
  62. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/models/CognitoIdentityServiceException.d.ts +1 -0
  63. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/models/errors.d.ts +9 -0
  64. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/SigninServiceException.d.ts +1 -0
  65. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/errors.d.ts +4 -0
  66. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/models/SSOServiceException.d.ts +1 -0
  67. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/models/errors.d.ts +4 -0
  68. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/models/SSOOIDCServiceException.d.ts +1 -0
  69. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/models/errors.d.ts +11 -0
  70. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/STSServiceException.d.ts +1 -0
  71. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/errors.d.ts +7 -0
  72. package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  73. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +3 -3
  74. package/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +3 -0
  75. package/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +3 -0
  76. package/node_modules/@aws-sdk/types/package.json +1 -1
  77. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +2 -0
  78. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js +21 -86
  79. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +3 -103
  80. package/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-TFS67BSI.js → chunk-23QDZLZG.js} +20 -14
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-IB6ONE3U.js → chunk-QPFSTNX5.js} +1 -1
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{virtual-modules-P5ROWYIG.js → virtual-modules-GRXGP6ZA.js} +1 -1
  84. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli-runtime.js +1 -1
  85. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  86. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  87. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Agent.md +8 -8
  88. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  89. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Client.md +11 -6
  90. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
  91. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Dispatcher.md +12 -0
  92. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Errors.md +101 -1
  93. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Fetch.md +10 -0
  94. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  95. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Interceptors.md +17 -9
  96. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Pool.md +5 -6
  97. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  98. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/index.md +22 -13
  99. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/type-map.json +66 -66
  100. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/readable.js +1 -2
  101. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  102. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  103. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/connect.js +10 -4
  104. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/constants.js +12 -1
  105. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/errors.js +38 -1
  106. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/request.js +39 -3
  107. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/symbols.js +2 -0
  108. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/util.js +26 -40
  109. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/agent.js +6 -2
  110. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h1.js +127 -84
  111. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h2.js +97 -21
  112. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client.js +10 -2
  113. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  114. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  115. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
  116. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  117. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/pool-base.js +117 -19
  118. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/pool.js +99 -13
  119. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/proxy-agent.js +34 -11
  120. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  121. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  122. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-handler.js +153 -15
  123. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/deduplication-handler.js +126 -52
  124. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/redirect-handler.js +31 -6
  125. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/retry-handler.js +116 -24
  126. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/cache.js +15 -4
  127. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/decompress.js +253 -73
  128. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dns.js +11 -0
  129. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/response-error.js +72 -28
  130. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/milo/LICENSE.md +7 -0
  131. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/milo/no-simd.js +1002 -0
  132. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/milo/simd.js +1002 -0
  133. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-agent.js +11 -0
  134. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  135. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  136. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/cache.js +11 -5
  137. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/cache.js +17 -8
  138. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
  139. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/index.js +19 -7
  140. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/util.js +21 -2
  141. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  142. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource.js +50 -3
  143. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/body.js +69 -53
  144. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  145. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  146. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/formdata.js +30 -36
  147. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/headers.js +36 -33
  148. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/index.js +54 -29
  149. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/request.js +74 -79
  150. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/response.js +43 -44
  151. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/util.js +7 -7
  152. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/infra/index.js +16 -1
  153. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  154. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/webidl/index.js +2 -14
  155. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/connection.js +33 -12
  156. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/events.js +43 -26
  157. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/receiver.js +27 -4
  158. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
  159. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
  160. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/websocket.js +44 -41
  161. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/package.json +7 -5
  162. package/node_modules/@earendil-works/pi-coding-agent/package.json +2 -2
  163. package/node_modules/@hono/node-server/README.md +2 -0
  164. package/node_modules/@hono/node-server/dist/index.cjs +1 -1
  165. package/node_modules/@hono/node-server/dist/index.mjs +1 -1
  166. package/node_modules/@hono/node-server/dist/serve-static.cjs +2 -1
  167. package/node_modules/@hono/node-server/dist/serve-static.mjs +2 -1
  168. package/node_modules/@hono/node-server/package.json +2 -2
  169. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts.map +1 -1
  170. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js +10 -0
  171. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map +1 -1
  172. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts +8 -8
  173. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts.map +1 -1
  174. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map +1 -1
  175. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +10 -0
  176. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -1
  177. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts +8 -8
  178. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map +1 -1
  179. package/node_modules/@modelcontextprotocol/sdk/package.json +1 -1
  180. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +15 -2
  181. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +2 -1
  182. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +2 -1
  183. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -0
  184. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -0
  185. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1695 -3
  186. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +16 -2
  187. package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/cache/EndpointCache.js +2 -1
  188. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +10 -0
  189. package/node_modules/@smithy/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js +6 -0
  190. package/node_modules/@smithy/core/dist-es/submodules/protocols/UnionSerde.js +26 -0
  191. package/node_modules/@smithy/core/dist-es/submodules/protocols/common.js +3 -0
  192. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +8 -0
  193. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +102 -0
  194. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +8 -1
  195. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +8 -1
  196. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +13 -2
  197. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +16 -6
  198. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/parseJsonBody.js +16 -1
  199. package/node_modules/@smithy/core/dist-es/submodules/protocols/writeKey.js +3 -0
  200. package/node_modules/@smithy/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  201. package/node_modules/@smithy/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
  202. package/node_modules/@smithy/core/dist-types/submodules/protocols/common.d.ts +2 -0
  203. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +9 -0
  204. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +13 -0
  205. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  206. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +16 -0
  207. package/node_modules/@smithy/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
  208. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  209. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -0
  210. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -0
  211. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +9 -0
  212. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +13 -0
  213. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  214. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -11
  215. package/node_modules/{@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json → @smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +7 -4
  216. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
  217. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
  218. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  219. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -9
  220. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
  221. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
  222. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
  223. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -0
  224. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -0
  225. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
  226. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +38 -0
  227. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
  228. package/node_modules/@smithy/core/package.json +2 -1
  229. package/node_modules/@types/node/README.md +1 -1
  230. package/node_modules/@types/node/package.json +2 -2
  231. package/node_modules/@types/node/util.d.ts +6 -3
  232. package/node_modules/body-parser/README.md +17 -13
  233. package/node_modules/body-parser/lib/read.js +74 -57
  234. package/node_modules/body-parser/lib/types/json.js +11 -11
  235. package/node_modules/body-parser/lib/types/urlencoded.js +5 -5
  236. package/node_modules/body-parser/lib/utils.js +0 -15
  237. package/node_modules/body-parser/package.json +7 -12
  238. package/node_modules/content-disposition/README.md +105 -35
  239. package/node_modules/content-disposition/dist/index.d.ts +72 -0
  240. package/node_modules/content-disposition/dist/index.js +388 -0
  241. package/node_modules/content-disposition/dist/index.js.map +1 -0
  242. package/node_modules/content-disposition/package.json +31 -19
  243. package/node_modules/express/Readme.md +15 -9
  244. package/node_modules/express/lib/application.js +2 -2
  245. package/node_modules/express/lib/request.js +32 -19
  246. package/node_modules/express/lib/response.js +27 -30
  247. package/node_modules/express/node_modules/content-type/LICENSE +22 -0
  248. package/node_modules/express/node_modules/content-type/README.md +71 -0
  249. package/node_modules/express/node_modules/content-type/dist/index.d.ts +46 -0
  250. package/node_modules/express/node_modules/content-type/dist/index.js +176 -0
  251. package/node_modules/express/node_modules/content-type/dist/index.js.map +1 -0
  252. package/node_modules/express/node_modules/content-type/package.json +52 -0
  253. package/node_modules/express/package.json +10 -10
  254. package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
  255. package/node_modules/fast-uri/README.md +8 -0
  256. package/node_modules/fast-uri/index.js +98 -18
  257. package/node_modules/fast-uri/lib/utils.js +52 -0
  258. package/node_modules/fast-uri/package.json +1 -1
  259. package/node_modules/fast-uri/test/host-delimiter-security.test.js +94 -0
  260. package/node_modules/fast-uri/test/relative-normalization-security.test.js +156 -0
  261. package/node_modules/fast-uri/test/reserved-path-normalization.test.js +32 -4
  262. package/node_modules/fast-uri/test/scheme-validation.test.js +53 -14
  263. package/node_modules/hono/README.md +2 -3
  264. package/node_modules/hono/dist/cjs/helper/css/common.js +8 -3
  265. package/node_modules/hono/dist/cjs/helper/css/index.js +1 -1
  266. package/node_modules/hono/dist/cjs/helper/route/index.js +3 -1
  267. package/node_modules/hono/dist/cjs/jsx/base.js +1 -1
  268. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +8 -0
  269. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +3 -1
  270. package/node_modules/hono/dist/cjs/router/trie-router/node.js +2 -2
  271. package/node_modules/hono/dist/cjs/utils/url.js +11 -6
  272. package/node_modules/hono/dist/helper/css/common.js +8 -3
  273. package/node_modules/hono/dist/helper/css/index.js +1 -1
  274. package/node_modules/hono/dist/helper/route/index.js +3 -1
  275. package/node_modules/hono/dist/jsx/base.js +1 -1
  276. package/node_modules/hono/dist/middleware/bearer-auth/index.js +8 -0
  277. package/node_modules/hono/dist/middleware/serve-static/index.js +3 -1
  278. package/node_modules/hono/dist/router/trie-router/node.js +2 -2
  279. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +1 -1
  280. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +1 -1
  281. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +1 -1
  282. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +1 -1
  283. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +1 -1
  284. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +1 -1
  285. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +1 -1
  286. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +1 -1
  287. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +1 -1
  288. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +1 -1
  289. package/node_modules/hono/dist/types/helper/testing/index.d.ts +2 -1
  290. package/node_modules/hono/dist/types/hono-base.d.ts +21 -9
  291. package/node_modules/hono/dist/types/index.d.ts +1 -1
  292. package/node_modules/hono/dist/types/jsx/components.d.ts +2 -2
  293. package/node_modules/hono/dist/types/jsx/context.d.ts +2 -2
  294. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +2 -2
  295. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +2 -2
  296. package/node_modules/hono/dist/types/jsx/streaming.d.ts +4 -3
  297. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +2 -1
  298. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +3 -3
  299. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +3 -3
  300. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +1 -1
  301. package/node_modules/hono/dist/utils/url.js +11 -6
  302. package/node_modules/hono/package.json +1 -1
  303. package/node_modules/ip-address/README.md +70 -70
  304. package/node_modules/ip-address/dist/common.js +2 -2
  305. package/node_modules/ip-address/dist/common.js.map +1 -1
  306. package/node_modules/ip-address/dist/ipv6.js +7 -4
  307. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  308. package/node_modules/ip-address/dist/v6/constants.d.ts +3 -0
  309. package/node_modules/ip-address/dist/v6/constants.js +3 -0
  310. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  311. package/node_modules/ip-address/package.json +3 -2
  312. package/node_modules/jose/README.md +2 -2
  313. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +5 -4
  314. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -4
  315. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +5 -4
  316. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +5 -5
  317. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +5 -4
  318. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +5 -5
  319. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -4
  320. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +5 -5
  321. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -4
  322. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +6 -5
  323. package/node_modules/jose/dist/types/jws/general/sign.d.ts +9 -6
  324. package/node_modules/jose/dist/types/jws/general/verify.d.ts +7 -5
  325. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +7 -6
  326. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +1 -1
  327. package/node_modules/jose/dist/types/jwt/sign.d.ts +1 -1
  328. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +1 -1
  329. package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -5
  330. package/node_modules/jose/dist/types/key/export.d.ts +1 -1
  331. package/node_modules/jose/dist/types/key/generate_secret.d.ts +1 -1
  332. package/node_modules/jose/dist/types/key/import.d.ts +2 -2
  333. package/node_modules/jose/dist/types/types.d.ts +165 -107
  334. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +2 -2
  335. package/node_modules/jose/dist/types/util/errors.d.ts +1 -1
  336. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +3 -3
  337. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +8 -8
  338. package/node_modules/jose/dist/webapi/jwks/local.js +2 -1
  339. package/node_modules/jose/dist/webapi/jwks/remote.js +4 -4
  340. package/node_modules/jose/dist/webapi/jws/general/sign.js +3 -3
  341. package/node_modules/jose/dist/webapi/jws/general/verify.js +3 -3
  342. package/node_modules/jose/dist/webapi/jwt/encrypt.js +2 -2
  343. package/node_modules/jose/dist/webapi/jwt/sign.js +2 -2
  344. package/node_modules/jose/dist/webapi/jwt/unsecured.js +3 -3
  345. package/node_modules/jose/dist/webapi/key/generate_secret.js +4 -4
  346. package/node_modules/jose/dist/webapi/lib/asn1.js +2 -2
  347. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +4 -4
  348. package/node_modules/jose/dist/webapi/lib/content_encryption.js +8 -8
  349. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +14 -14
  350. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +3 -3
  351. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -2
  352. package/node_modules/jose/dist/webapi/lib/jws_sign.js +11 -11
  353. package/node_modules/jose/dist/webapi/lib/jws_verify.js +19 -16
  354. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +44 -43
  355. package/node_modules/jose/dist/webapi/lib/key.js +4 -4
  356. package/node_modules/jose/dist/webapi/lib/key_management.js +17 -17
  357. package/node_modules/jose/dist/webapi/lib/validate.js +10 -10
  358. package/node_modules/jose/dist/webapi/util/decode_jwt.js +12 -12
  359. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -5
  360. package/node_modules/jose/package.json +1 -1
  361. package/node_modules/on-finished/index.js +14 -2
  362. package/node_modules/on-finished/package.json +11 -7
  363. package/node_modules/qs/.github/THREAT_MODEL.md +4 -2
  364. package/node_modules/qs/CHANGELOG.md +38 -14
  365. package/node_modules/qs/README.md +31 -3
  366. package/node_modules/qs/dist/qs.js +20 -20
  367. package/node_modules/qs/lib/parse.js +94 -4
  368. package/node_modules/qs/lib/stringify.js +4 -4
  369. package/node_modules/qs/lib/utils.js +130 -6
  370. package/node_modules/qs/package.json +4 -4
  371. package/node_modules/qs/test/parse.js +174 -0
  372. package/node_modules/qs/test/stringify.js +263 -33
  373. package/node_modules/qs/test/utils.js +184 -0
  374. package/node_modules/undici/docs/docs/api/Client.md +2 -0
  375. package/node_modules/undici/lib/core/connect.js +10 -4
  376. package/node_modules/undici/lib/core/symbols.js +1 -0
  377. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  378. package/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
  379. package/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
  380. package/node_modules/undici/lib/dispatcher/client.js +3 -2
  381. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
  382. package/node_modules/undici/lib/handler/cache-handler.js +48 -0
  383. package/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
  384. package/node_modules/undici/lib/handler/redirect-handler.js +8 -1
  385. package/node_modules/undici/lib/interceptor/decompress.js +15 -5
  386. package/node_modules/undici/lib/web/cookies/index.js +3 -1
  387. package/node_modules/undici/lib/web/cookies/parse.js +138 -137
  388. package/node_modules/undici/lib/web/cookies/util.js +21 -2
  389. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
  390. package/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  391. package/node_modules/undici/lib/web/fetch/index.js +3 -3
  392. package/node_modules/undici/lib/web/infra/index.js +14 -0
  393. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  394. package/node_modules/undici/lib/web/websocket/receiver.js +13 -0
  395. package/node_modules/undici/package.json +1 -1
  396. package/node_modules/undici/types/client.d.ts +14 -0
  397. package/node_modules/zod/package.json +1 -1
  398. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  399. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  400. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  401. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  402. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  403. package/node_modules/zod/src/v4/core/util.ts +13 -0
  404. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  405. package/node_modules/zod/v4/core/compile.cjs +8 -0
  406. package/node_modules/zod/v4/core/compile.js +8 -0
  407. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  408. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  409. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  410. package/node_modules/zod/v4/core/schemas.js +30 -0
  411. package/node_modules/zod/v4/core/util.cjs +15 -0
  412. package/node_modules/zod/v4/core/util.d.cts +2 -0
  413. package/node_modules/zod/v4/core/util.d.ts +2 -0
  414. package/node_modules/zod/v4/core/util.js +14 -0
  415. package/node_modules/zod/v4/core/versions.cjs +1 -1
  416. package/node_modules/zod/v4/core/versions.js +1 -1
  417. package/package.json +5 -4
  418. package/sling-default-packages.json +3 -2
  419. package/slingshot/index.js +124 -124
  420. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
  421. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
  422. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
  423. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
  424. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
  425. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
  426. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
  427. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
  428. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
  429. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
  430. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
  431. package/node_modules/content-disposition/index.js +0 -536
  432. package/node_modules/on-finished/HISTORY.md +0 -98
  433. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -0
  434. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -0
  435. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -0
  436. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -0
  437. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -0
  438. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -0
  439. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -0
  440. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -0
  441. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/needsReviver.js +0 -0
  442. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -0
  443. /package/node_modules/{@aws-sdk/core/dist-types/submodules/protocols/json → @smithy/core/dist-types/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +0 -0
  444. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -0
  445. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -0
  446. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -0
  447. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -0
  448. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -0
  449. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -0
  450. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -0
  451. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -0
  452. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -0
  453. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -0
@@ -0,0 +1,1064 @@
1
+ 'use strict'
2
+
3
+ const assert = require('node:assert')
4
+ const util = require('../core/util.js')
5
+ const timers = require('../util/timers.js')
6
+ const {
7
+ HeadersTimeoutError,
8
+ HeadersOverflowError,
9
+ SocketError,
10
+ InformationalError,
11
+ BodyTimeoutError,
12
+ HTTPParserError,
13
+ ResponseContentLengthMismatchError,
14
+ ResponseExceededMaxSizeError
15
+ } = require('../core/errors.js')
16
+ const {
17
+ kUrl,
18
+ kReset,
19
+ kClient,
20
+ kParser,
21
+ kBlocking,
22
+ kRunning,
23
+ kWriting,
24
+ kQueue,
25
+ kKeepAliveDefaultTimeout,
26
+ kRunningIdx,
27
+ kError,
28
+ kPipelining,
29
+ kSocket,
30
+ kKeepAliveTimeoutValue,
31
+ kKeepAliveMaxTimeout,
32
+ kKeepAliveTimeoutThreshold,
33
+ kBodyTimeout,
34
+ kMaxResponseSize,
35
+ kResume,
36
+ kHTTPContext,
37
+ kMaxHeadersSize
38
+ } = require('../core/symbols.js')
39
+
40
+ const FastBuffer = Buffer[Symbol.species]
41
+ const removeAllListeners = util.removeAllListeners
42
+
43
+ const kPausedByHandler = Symbol('kPausedByHandler')
44
+
45
+ const BUFFER_PAGE_SIZE = 4096
46
+ const INITIAL_BUFFER_SIZE = 128 * 1024
47
+ const EMPTY_BUF = Buffer.alloc(0)
48
+ const BODY_KIND_CONTENT_LENGTH = 0
49
+ const EVENT_RANGE_SIZE = 9
50
+ const EVENT_HEADERS_SIZE = 19
51
+
52
+ let miloPackage
53
+
54
+ // We disable wasm SIMD on ppc64 as it seems to be broken on Power 9 architectures.
55
+ let useWasmSIMD = process.arch !== 'ppc64'
56
+ // The Env Variable UNDICI_NO_WASM_SIMD allows explicitly overriding the default behavior.
57
+ if (process.env.UNDICI_NO_WASM_SIMD === '1') {
58
+ useWasmSIMD = false
59
+ } else if (process.env.UNDICI_NO_WASM_SIMD === '0') {
60
+ useWasmSIMD = true
61
+ }
62
+
63
+ const USE_NATIVE_TIMER = 0
64
+ const USE_FAST_TIMER = 1
65
+ const TIMEOUT_HEADERS = 2 | USE_FAST_TIMER
66
+ const TIMEOUT_BODY = 4 | USE_FAST_TIMER
67
+ const TIMEOUT_KEEP_ALIVE = 8 | USE_NATIVE_TIMER
68
+
69
+ let miloEnabled =
70
+ process.env.UNDICI_USE_MILO === '1' || process.env.UNDICI_USE_MILO === 'true'
71
+ let miloInstance = null
72
+ let currentBuffer = null
73
+ let currentBufferSize = 0
74
+ let currentBufferPtr = null
75
+ let currentBufferRef = null
76
+
77
+ function onParserTimeout (parserWeakRef) {
78
+ const parser = parserWeakRef.deref ? parserWeakRef.deref() : parserWeakRef
79
+ if (!parser) {
80
+ return
81
+ }
82
+
83
+ const { socket, timeoutType, client, paused } = parser
84
+
85
+ if (timeoutType === TIMEOUT_HEADERS) {
86
+ if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
87
+ assert(!paused, 'cannot be paused while waiting for headers')
88
+ util.destroy(socket, new HeadersTimeoutError())
89
+ }
90
+ } else if (timeoutType === TIMEOUT_BODY) {
91
+ if (!paused) {
92
+ util.destroy(socket, new BodyTimeoutError())
93
+ }
94
+ } else if (timeoutType === TIMEOUT_KEEP_ALIVE) {
95
+ assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue])
96
+ util.destroy(socket, new InformationalError('socket idle timeout'))
97
+ }
98
+ }
99
+
100
+ function getMilo () {
101
+ if (miloInstance) {
102
+ return miloInstance
103
+ }
104
+
105
+ // Milo modules compile WASM on load; defer loading until the parser is needed.
106
+ if (useWasmSIMD) {
107
+ try {
108
+ miloPackage = require('../milo/simd.js')
109
+ } catch {}
110
+ }
111
+
112
+ miloPackage = miloPackage || require('../milo/no-simd.js')
113
+ miloInstance = miloPackage.setup()
114
+ return miloInstance
115
+ }
116
+
117
+ class H1Parser {
118
+ constructor (client, socket) {
119
+ this.milo = getMilo()
120
+
121
+ this.client = client
122
+ this.socket = socket
123
+ this.parser = this.milo.create()
124
+ this.events = new FastBuffer(
125
+ this.milo.memory.buffer,
126
+ this.parser + this.milo.ParserFields.EVENTS,
127
+ 4
128
+ ).readUInt32LE(0)
129
+
130
+ this.milo.setShouldAutodetect(this.parser, false)
131
+ this.milo.setIsRequest(this.parser, false)
132
+ this.milo.setShouldManageUnconsumed(this.parser, false)
133
+ this.milo.setShouldSuspendAfterHeaders(this.parser, true)
134
+ this.milo.setMaxHeaderLength(this.parser, client[kMaxHeadersSize])
135
+ this.milo.setActiveEvents(
136
+ this.parser,
137
+ this.milo.EVENT_ACTIVE_ON_ERROR |
138
+ this.milo.EVENT_ACTIVE_ON_MESSAGE_COMPLETE |
139
+ this.milo.EVENT_ACTIVE_ON_REASON |
140
+ this.milo.EVENT_ACTIVE_ON_HEADER_NAME |
141
+ this.milo.EVENT_ACTIVE_ON_HEADER_VALUE |
142
+ this.milo.EVENT_ACTIVE_ON_HEADERS |
143
+ this.milo.EVENT_ACTIVE_ON_DATA |
144
+ this.milo.EVENT_ACTIVE_ON_TRAILER_NAME |
145
+ this.milo.EVENT_ACTIVE_ON_TRAILER_VALUE
146
+ )
147
+
148
+ this.timeout = null
149
+ this.timeoutWeakRef = new WeakRef(this)
150
+ this.timeoutValue = null
151
+ this.timeoutType = null
152
+ this.statusCode = 0
153
+ this.statusText = ''
154
+ this.upgrade = false
155
+ this.responseStarted = false
156
+ this.pausedByParser = false
157
+ this.pauseStateIsStart = false
158
+ this.headers = []
159
+ this.trailers = []
160
+ this.headersSize = 0
161
+ this.trailersSize = 0
162
+ this.headersMaxSize = client[kMaxHeadersSize]
163
+ this.shouldKeepAlive = false
164
+ this.paused = false
165
+ this.errored = false
166
+ this.waitingForMoreData = 0
167
+ this.resume = this.resume.bind(this)
168
+ this.bytesRead = 0
169
+ this.keepAlive = ''
170
+ this.connection = ''
171
+ this.contentLength = -1
172
+ this.maxResponseSize = client[kMaxResponseSize]
173
+ this.directBodyRemaining = 0
174
+ this.directBodyCompletePending = false
175
+ this.headersSuspended = false
176
+ this.skipBody = false
177
+
178
+ this[kPausedByHandler] = false
179
+
180
+ if (
181
+ INITIAL_BUFFER_SIZE > currentBufferSize ||
182
+ currentBuffer.buffer !== this.milo.memory.buffer
183
+ ) {
184
+ this.ensureBuffers(INITIAL_BUFFER_SIZE)
185
+ } else {
186
+ this.updateBuffers()
187
+ }
188
+ }
189
+
190
+ setTimeout (delay, type) {
191
+ if (
192
+ delay !== this.timeoutValue ||
193
+ (type & USE_FAST_TIMER) ^ (this.timeoutType & USE_FAST_TIMER)
194
+ ) {
195
+ if (this.timeout) {
196
+ timers.clearTimeout(this.timeout)
197
+ this.timeout = null
198
+ }
199
+
200
+ if (delay) {
201
+ if (type & USE_FAST_TIMER) {
202
+ this.timeout = timers.setFastTimeout(
203
+ onParserTimeout,
204
+ delay,
205
+ this.timeoutWeakRef
206
+ )
207
+ } else {
208
+ this.timeout = setTimeout(
209
+ onParserTimeout,
210
+ delay,
211
+ this.timeoutWeakRef
212
+ )
213
+ this.timeout?.unref()
214
+ }
215
+ }
216
+
217
+ this.timeoutValue = delay
218
+ } else if (this.timeout?.refresh) {
219
+ this.timeout.refresh()
220
+ }
221
+
222
+ this.timeoutType = type
223
+ }
224
+
225
+ ensureBuffers (size) {
226
+ const { milo } = this
227
+
228
+ if (currentBufferPtr != null) {
229
+ milo.dealloc(currentBufferPtr, currentBufferSize)
230
+ }
231
+
232
+ // Reallocate buffers
233
+ currentBufferSize = Math.ceil(size / BUFFER_PAGE_SIZE) * BUFFER_PAGE_SIZE
234
+ currentBufferPtr = milo.alloc(currentBufferSize)
235
+ currentBuffer = new FastBuffer(
236
+ milo.memory.buffer,
237
+ currentBufferPtr,
238
+ currentBufferSize
239
+ )
240
+
241
+ this.updateBuffers()
242
+ }
243
+
244
+ updateBuffers () {
245
+ this.parserFields = new FastBuffer(this.milo.memory.buffer, this.parser)
246
+ this.parserEvents = new FastBuffer(
247
+ this.milo.memory.buffer,
248
+ this.events,
249
+ 64 * 1024
250
+ )
251
+ }
252
+
253
+ resume () {
254
+ if (this.socket.destroyed || !this.paused) {
255
+ return
256
+ }
257
+
258
+ this.milo.resume(this.parser)
259
+
260
+ assert(this.timeoutType === TIMEOUT_BODY)
261
+ if (this.timeout?.refresh) {
262
+ this.timeout.refresh()
263
+ }
264
+
265
+ this.paused = false
266
+ if (this.directBodyCompletePending) {
267
+ try {
268
+ this.completeDirectBody()
269
+ } catch (err) {
270
+ util.destroy(this.socket, err)
271
+ return
272
+ }
273
+
274
+ if (this.paused) {
275
+ return
276
+ }
277
+ }
278
+
279
+ this.readMore()
280
+ }
281
+
282
+ readMore () {
283
+ if (this.paused || !this.parser) {
284
+ return
285
+ }
286
+
287
+ while (!this.paused && this.parser) {
288
+ if (
289
+ this.waitingForMoreData &&
290
+ this.socket.readableLength <= this.waitingForMoreData
291
+ ) {
292
+ break
293
+ }
294
+
295
+ this.waitingForMoreData = 0
296
+
297
+ const chunk = this.socket.read()
298
+ if (chunk === null) {
299
+ break
300
+ }
301
+
302
+ if (this.execute(chunk) === false) {
303
+ break
304
+ }
305
+ }
306
+ }
307
+
308
+ execute (data) {
309
+ const available = data.length
310
+ assert(!this.paused)
311
+
312
+ const { socket, milo } = this
313
+
314
+ try {
315
+ if (this.directBodyRemaining > 0) {
316
+ return this.consumeDirectBody(data)
317
+ }
318
+
319
+ if (currentBuffer.buffer !== milo.memory.buffer) {
320
+ currentBuffer = new FastBuffer(
321
+ milo.memory.buffer,
322
+ currentBufferPtr,
323
+ currentBufferSize
324
+ )
325
+ this.updateBuffers()
326
+ } else if (this.parserEvents.buffer !== milo.memory.buffer) {
327
+ this.updateBuffers()
328
+ }
329
+
330
+ let offset = 0
331
+ let parseLen = available
332
+ const headersEnd = this.statusCode === 0 ? data.indexOf('\r\n\r\n') : -1
333
+
334
+ if (headersEnd !== -1) {
335
+ parseLen = headersEnd + 4
336
+ }
337
+
338
+ for (;;) {
339
+ if (parseLen > currentBufferSize) {
340
+ this.ensureBuffers(parseLen)
341
+ }
342
+
343
+ const parseData = data.subarray(offset, offset + parseLen)
344
+ currentBuffer.set(parseData)
345
+ currentBufferRef = parseData
346
+
347
+ const consumed = milo.parse(this.parser, currentBufferPtr, parseLen)
348
+ this.drainEvents()
349
+
350
+ const consumedTotal = offset + consumed
351
+
352
+ if (
353
+ this.errored ||
354
+ (consumed === 0 &&
355
+ this.parserFields[milo.ParserFields.ERROR_CODE] !== milo.ERROR_NONE)
356
+ ) {
357
+ throw this.createError(data.subarray(consumedTotal))
358
+ } else if (this.upgrade) {
359
+ this.onUpgrade(data.subarray(consumedTotal))
360
+ return false
361
+ } else if (this.directBodyCompletePending) {
362
+ this.completeDirectBody()
363
+
364
+ if (this.paused) {
365
+ return false
366
+ }
367
+ } else if (this.pausedByParser) {
368
+ this.pausedByParser = false
369
+ this.headersSuspended = false
370
+ if (this[kPausedByHandler] && this.pauseStateIsStart) {
371
+ this.pauseStateIsStart = false
372
+ milo.resume(this.parser)
373
+ this[kPausedByHandler] = false
374
+ return false
375
+ }
376
+
377
+ this.pauseStateIsStart = false
378
+ this.paused = true
379
+ socket.unshift(data.subarray(consumedTotal))
380
+ return false
381
+ }
382
+
383
+ if (this.directBodyRemaining > 0) {
384
+ return this.consumeDirectBody(data.subarray(consumedTotal))
385
+ }
386
+
387
+ if (consumed < parseLen) {
388
+ const remaining = data.subarray(consumedTotal)
389
+ socket.unshift(remaining)
390
+ this.waitingForMoreData = consumed === 0 ? remaining.length : 0
391
+ return false
392
+ }
393
+
394
+ offset = consumedTotal
395
+
396
+ if (offset >= available) {
397
+ if (this.headersSuspended) {
398
+ this.headersSuspended = false
399
+ parseLen = 0
400
+ continue
401
+ }
402
+
403
+ return true
404
+ }
405
+
406
+ this.headersSuspended = false
407
+ parseLen = available - offset
408
+ }
409
+ } catch (err) {
410
+ util.destroy(socket, err)
411
+ return false
412
+ } finally {
413
+ currentBufferRef = null
414
+ }
415
+ }
416
+
417
+ consumeDirectBody (data) {
418
+ const { socket, client, maxResponseSize } = this
419
+ const available = data.length
420
+ const len = Math.min(available, this.directBodyRemaining)
421
+
422
+ if (this.timeout?.refresh) {
423
+ this.timeout.refresh()
424
+ }
425
+
426
+ if (len > 0) {
427
+ const request = client[kQueue][client[kRunningIdx]]
428
+ assert(request)
429
+ assert(this.timeoutType === TIMEOUT_BODY)
430
+ assert(this.statusCode >= 200)
431
+
432
+ if (maxResponseSize > -1 && this.bytesRead + len > maxResponseSize) {
433
+ throw new ResponseExceededMaxSizeError()
434
+ }
435
+
436
+ this.bytesRead += len
437
+ this.directBodyRemaining -= len
438
+
439
+ if (request.onResponseData(data.subarray(0, len)) === false) {
440
+ this.directBodyCompletePending = this.directBodyRemaining === 0
441
+ this.pauseParser()
442
+ this[kPausedByHandler] = true
443
+ this.pausedByParser = false
444
+ this.paused = true
445
+
446
+ if (len < available) {
447
+ socket.unshift(data.subarray(len))
448
+ }
449
+
450
+ return false
451
+ }
452
+ }
453
+
454
+ if (this.directBodyRemaining === 0) {
455
+ this.completeDirectBody()
456
+
457
+ const remaining = data.subarray(len)
458
+ if (
459
+ this.errored ||
460
+ this.parserFields[this.milo.ParserFields.ERROR_CODE] !==
461
+ this.milo.ERROR_NONE
462
+ ) {
463
+ throw this.createError(remaining)
464
+ } else if (this.pausedByParser) {
465
+ this.pausedByParser = false
466
+ this.pauseStateIsStart = false
467
+ this.paused = true
468
+ if (remaining.length > 0) {
469
+ socket.unshift(remaining)
470
+ }
471
+ return false
472
+ }
473
+
474
+ if (remaining.length > 0) {
475
+ socket.unshift(remaining)
476
+ return false
477
+ }
478
+ }
479
+
480
+ return true
481
+ }
482
+
483
+ completeDirectBody () {
484
+ const { milo } = this
485
+
486
+ if (currentBuffer.buffer !== milo.memory.buffer) {
487
+ currentBuffer = new FastBuffer(
488
+ milo.memory.buffer,
489
+ currentBufferPtr,
490
+ currentBufferSize
491
+ )
492
+ this.updateBuffers()
493
+ } else if (this.parserEvents.buffer !== milo.memory.buffer) {
494
+ this.updateBuffers()
495
+ }
496
+
497
+ this.directBodyCompletePending = false
498
+ currentBufferRef = EMPTY_BUF
499
+
500
+ milo.complete(this.parser)
501
+ this.drainEvents()
502
+ }
503
+
504
+ setShouldSkipBody (value) {
505
+ if (this.skipBody !== value) {
506
+ this.skipBody = value
507
+ this.milo.setShouldSkipBody(this.parser, value)
508
+ }
509
+ }
510
+
511
+ finish () {
512
+ if (!this.parser) {
513
+ return null
514
+ }
515
+
516
+ if (this.directBodyRemaining > 0) {
517
+ return new ResponseContentLengthMismatchError()
518
+ }
519
+
520
+ if (this.parserEvents.buffer !== this.milo.memory.buffer) {
521
+ this.updateBuffers()
522
+ }
523
+
524
+ this.milo.finish(this.parser)
525
+ this.drainEvents()
526
+
527
+ if (!this.errored) {
528
+ return null
529
+ }
530
+
531
+ return this.createError(EMPTY_BUF)
532
+ }
533
+
534
+ createError (data) {
535
+ const { contentLength, bytesRead } = this
536
+
537
+ if (contentLength !== -1 && bytesRead !== contentLength) {
538
+ return new ResponseContentLengthMismatchError()
539
+ }
540
+
541
+ const errorCode = this.parserFields[this.milo.ParserFields.ERROR_CODE]
542
+ const errorName = this.milo.Errors[errorCode]
543
+ const errorDescription =
544
+ errorName === 'UNEXPECTED_EOF'
545
+ ? 'Invalid EOF state'
546
+ : this.milo.getErrorDescription(this.parser)
547
+ const reason =
548
+ errorName === 'UNEXPECTED_EOF'
549
+ ? errorDescription
550
+ : errorDescription
551
+ ? `[ERROR_${errorName}] ${errorDescription}`
552
+ : `ERROR_${errorName}`
553
+ return new HTTPParserError(
554
+ `Response does not match the HTTP/1.1 protocol (${reason})`,
555
+ errorName,
556
+ data
557
+ )
558
+ }
559
+
560
+ destroy () {
561
+ if (this.parser) {
562
+ this.milo.destroy(this.parser)
563
+ this.parser = null
564
+ }
565
+
566
+ this.timeout && timers.clearTimeout(this.timeout)
567
+ this.timeout = null
568
+ this.timeoutValue = null
569
+ this.timeoutType = null
570
+ this.paused = false
571
+ this.responseStarted = false
572
+ this.pausedByParser = false
573
+ this.pauseStateIsStart = false
574
+ this.connection = ''
575
+ this.skipBody = false
576
+ }
577
+
578
+ pauseParser (stateIsStart = false) {
579
+ this.milo.pause(this.parser)
580
+ this.pausedByParser = true
581
+ this.pauseStateIsStart = stateIsStart
582
+ }
583
+
584
+ drainEvents () {
585
+ const { socket, client, milo } = this
586
+ let cursor = 0
587
+
588
+ const firstEvent = this.parserEvents[0]
589
+ if (
590
+ firstEvent !== milo.EVENT_END &&
591
+ firstEvent !== milo.EVENT_ERROR &&
592
+ !this.responseStarted
593
+ ) {
594
+ this.responseStarted = true
595
+
596
+ if (socket.destroyed) {
597
+ return this.fail(this.milo.ERROR_CALLBACK_ERROR, 'Other side closed')
598
+ }
599
+
600
+ const request = client[kQueue][client[kRunningIdx]]
601
+ if (!request) {
602
+ return this.fail(this.milo.ERROR_CALLBACK_ERROR, 'Missing request')
603
+ }
604
+
605
+ request.onResponseStarted()
606
+ }
607
+
608
+ for (;;) {
609
+ const event = this.parserEvents[cursor]
610
+ let eventLen = EVENT_RANGE_SIZE
611
+ switch (event) {
612
+ case milo.EVENT_END:
613
+ return
614
+ case milo.EVENT_ERROR:
615
+ this.errored = true
616
+ return
617
+ case milo.EVENT_MESSAGE_COMPLETE: {
618
+ const {
619
+ client,
620
+ socket,
621
+ statusCode,
622
+ upgrade,
623
+ trailers,
624
+ contentLength,
625
+ bytesRead,
626
+ shouldKeepAlive
627
+ } = this
628
+
629
+ this.responseStarted = false
630
+
631
+ if (socket.destroyed && (!statusCode || shouldKeepAlive)) {
632
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Other side closed')
633
+ }
634
+
635
+ if (upgrade) {
636
+ this.pauseParser()
637
+ return
638
+ }
639
+
640
+ assert(statusCode >= 100)
641
+
642
+ const request = client[kQueue][client[kRunningIdx]]
643
+ assert(request)
644
+
645
+ this.statusCode = 0
646
+ this.statusText = ''
647
+ this.bytesRead = 0
648
+ this.contentLength = -1
649
+ this.directBodyRemaining = 0
650
+ this.directBodyCompletePending = false
651
+ this.headersSuspended = false
652
+ this.skipBody = false
653
+ this.keepAlive = ''
654
+ this.connection = ''
655
+ this.trailers = []
656
+ this.trailersSize = 0
657
+
658
+ if (statusCode < 200) {
659
+ break
660
+ }
661
+
662
+ if (
663
+ request.method !== 'HEAD' &&
664
+ contentLength !== -1 &&
665
+ bytesRead !== contentLength
666
+ ) {
667
+ util.destroy(socket, new ResponseContentLengthMismatchError())
668
+ this.pauseParser()
669
+ break
670
+ }
671
+
672
+ request.onResponseEnd(trailers)
673
+
674
+ client[kQueue][client[kRunningIdx]++] = null
675
+
676
+ if (socket[kWriting]) {
677
+ assert(client[kRunning] === 0)
678
+ util.destroy(socket, new InformationalError('reset'))
679
+ this.pauseParser(true)
680
+ } else if (!shouldKeepAlive) {
681
+ util.destroy(socket, new InformationalError('reset'))
682
+ this.pauseParser(true)
683
+ } else if (socket[kReset] && client[kRunning] === 0) {
684
+ util.destroy(socket, new InformationalError('reset'))
685
+ this.pauseParser(true)
686
+ } else if (client[kPipelining] == null || client[kPipelining] === 1) {
687
+ setImmediate(client[kResume])
688
+ } else {
689
+ client[kResume]()
690
+ }
691
+
692
+ break
693
+ }
694
+ case milo.EVENT_REASON: {
695
+ const at = this.parserEvents.readUInt32LE(cursor + 1)
696
+ const len = this.parserEvents.readUInt32LE(cursor + 5)
697
+ this.statusText = new FastBuffer(
698
+ currentBufferRef.buffer,
699
+ currentBufferRef.byteOffset + at,
700
+ len
701
+ ).toString()
702
+ break
703
+ }
704
+ case milo.EVENT_HEADER_NAME: {
705
+ const at = this.parserEvents.readUInt32LE(cursor + 1)
706
+ const len = this.parserEvents.readUInt32LE(cursor + 5)
707
+ const data =
708
+ len > 0
709
+ ? new FastBuffer(
710
+ currentBufferRef.buffer,
711
+ currentBufferRef.byteOffset + at,
712
+ len
713
+ )
714
+ : EMPTY_BUF
715
+
716
+ this.headers.push(data)
717
+ this.headersSize += len
718
+ if (this.headersSize >= this.headersMaxSize) {
719
+ util.destroy(this.socket, new HeadersOverflowError())
720
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Headers overflow')
721
+ }
722
+
723
+ break
724
+ }
725
+ case milo.EVENT_HEADER_VALUE: {
726
+ const at = this.parserEvents.readUInt32LE(cursor + 1)
727
+ const len = this.parserEvents.readUInt32LE(cursor + 5)
728
+ const data =
729
+ len > 0
730
+ ? new FastBuffer(
731
+ currentBufferRef.buffer,
732
+ currentBufferRef.byteOffset + at,
733
+ len
734
+ )
735
+ : EMPTY_BUF
736
+ const key = this.headers[this.headers.length - 1]
737
+
738
+ this.headers.push(data)
739
+
740
+ if (key.length === 10) {
741
+ const headerName = util.bufferToLowerCasedHeaderName(key)
742
+ if (headerName === 'keep-alive') {
743
+ this.keepAlive += (this.keepAlive.length === 0 ? '' : ',') + data.toString()
744
+ } else if (headerName === 'connection') {
745
+ this.connection += (this.connection.length === 0 ? '' : ',') + data.toString()
746
+ }
747
+ }
748
+
749
+ this.headersSize += len
750
+ if (this.headersSize >= this.headersMaxSize) {
751
+ util.destroy(this.socket, new HeadersOverflowError())
752
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Headers overflow')
753
+ }
754
+
755
+ break
756
+ }
757
+ case milo.EVENT_HEADERS: {
758
+ eventLen = EVENT_HEADERS_SIZE
759
+
760
+ const statusCode = this.parserEvents.readUInt16LE(cursor + 5)
761
+ const shouldKeepAlive = this.parserEvents[cursor + 7] !== 0
762
+ const shouldUpgrade = this.parserEvents[cursor + 8] !== 0
763
+ const hasTrailers = this.parserEvents[cursor + 9] !== 0
764
+ const bodyKind = this.parserEvents[cursor + 10]
765
+ const contentLength =
766
+ this.parserEvents.readUInt32LE(cursor + 11) +
767
+ this.parserEvents.readUInt32LE(cursor + 15) * 0x100000000
768
+
769
+ const { socket, client, headers, statusText } = this
770
+
771
+ if (socket.destroyed) {
772
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Other side closed')
773
+ }
774
+
775
+ const request = client[kQueue][client[kRunningIdx]]
776
+ if (!request) {
777
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Missing request')
778
+ }
779
+
780
+ assert(!this.upgrade)
781
+ assert(this.statusCode < 200)
782
+
783
+ if (statusCode === 100) {
784
+ util.destroy(
785
+ socket,
786
+ new SocketError('bad response', util.getSocketInfo(socket))
787
+ )
788
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Bad response')
789
+ }
790
+
791
+ if (shouldUpgrade && !request.upgrade) {
792
+ util.destroy(
793
+ socket,
794
+ new SocketError('bad upgrade', util.getSocketInfo(socket))
795
+ )
796
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Bad upgrade')
797
+ }
798
+
799
+ assert(this.timeoutType === TIMEOUT_HEADERS)
800
+
801
+ this.statusCode = statusCode
802
+ this.shouldKeepAlive =
803
+ shouldKeepAlive ||
804
+ (request.method === 'HEAD' &&
805
+ !socket[kReset] &&
806
+ /(?:^|,)[\t ]*keep-alive[\t ]*(?:,|$)/i.test(this.connection) &&
807
+ !/(?:^|,)[\t ]*close[\t ]*(?:,|$)/i.test(this.connection))
808
+ this.contentLength =
809
+ bodyKind === BODY_KIND_CONTENT_LENGTH ? contentLength : -1
810
+
811
+ if (this.statusCode >= 200) {
812
+ const bodyTimeout =
813
+ request.bodyTimeout != null
814
+ ? request.bodyTimeout
815
+ : client[kBodyTimeout]
816
+ this.setTimeout(bodyTimeout, TIMEOUT_BODY)
817
+ } else if (this.timeout?.refresh) {
818
+ this.timeout.refresh()
819
+ }
820
+
821
+ if (request.method === 'CONNECT') {
822
+ assert(client[kRunning] === 1)
823
+ milo.setIsConnect(this.parser, true)
824
+ this.upgrade = true
825
+ return
826
+ }
827
+
828
+ if (shouldUpgrade) {
829
+ assert(client[kRunning] === 1)
830
+ this.upgrade = true
831
+ this.pauseParser()
832
+ return
833
+ }
834
+
835
+ this.headers = []
836
+ this.headersSize = 0
837
+
838
+ if (this.shouldKeepAlive && client[kPipelining]) {
839
+ const keepAliveTimeout = this.keepAlive
840
+ ? util.parseKeepAliveTimeout(this.keepAlive)
841
+ : null
842
+
843
+ if (keepAliveTimeout != null) {
844
+ const timeout = Math.min(
845
+ keepAliveTimeout - client[kKeepAliveTimeoutThreshold],
846
+ client[kKeepAliveMaxTimeout]
847
+ )
848
+ if (timeout <= 0) {
849
+ socket[kReset] = true
850
+ } else {
851
+ client[kKeepAliveTimeoutValue] = timeout
852
+ }
853
+ } else {
854
+ client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout]
855
+ }
856
+ } else {
857
+ socket[kReset] = true
858
+ }
859
+
860
+ const pause =
861
+ request.onResponseStart(
862
+ statusCode,
863
+ headers,
864
+ this.resume,
865
+ statusText
866
+ ) === false
867
+
868
+ if (request.aborted) {
869
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Request aborted')
870
+ }
871
+
872
+ if (request.method === 'HEAD' || statusCode < 200) {
873
+ this.setShouldSkipBody(true)
874
+ }
875
+
876
+ this.headersSuspended = true
877
+ if (
878
+ !pause &&
879
+ request.method !== 'HEAD' &&
880
+ statusCode >= 200 &&
881
+ statusCode !== 204 &&
882
+ statusCode !== 205 &&
883
+ statusCode !== 304 &&
884
+ bodyKind === BODY_KIND_CONTENT_LENGTH &&
885
+ contentLength > 0 &&
886
+ !hasTrailers
887
+ ) {
888
+ this.directBodyRemaining = contentLength
889
+ }
890
+
891
+ if (socket[kBlocking]) {
892
+ socket[kBlocking] = false
893
+ client[kResume]()
894
+ }
895
+
896
+ if (pause) {
897
+ this.pauseParser()
898
+ this[kPausedByHandler] = true
899
+ } else if (
900
+ request.method === 'HEAD' ||
901
+ statusCode < 200 ||
902
+ statusCode === 204 ||
903
+ statusCode === 205 ||
904
+ statusCode === 304 ||
905
+ (bodyKind === BODY_KIND_CONTENT_LENGTH && contentLength === 0)
906
+ ) {
907
+ this.directBodyCompletePending = true
908
+ }
909
+
910
+ break
911
+ }
912
+ case milo.EVENT_DATA: {
913
+ const at = this.parserEvents.readUInt32LE(cursor + 1)
914
+ const len = this.parserEvents.readUInt32LE(cursor + 5)
915
+ const { client, socket, statusCode, maxResponseSize } = this
916
+
917
+ if (socket.destroyed) {
918
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Other side closed')
919
+ }
920
+
921
+ const request = client[kQueue][client[kRunningIdx]]
922
+ assert(request)
923
+ assert(this.timeoutType === TIMEOUT_BODY)
924
+
925
+ if (this.timeout?.refresh) {
926
+ this.timeout.refresh()
927
+ }
928
+
929
+ assert(statusCode >= 200)
930
+
931
+ if (maxResponseSize > -1 && this.bytesRead + len > maxResponseSize) {
932
+ util.destroy(socket, new ResponseExceededMaxSizeError())
933
+ return this.fail(
934
+ milo.ERROR_CALLBACK_ERROR,
935
+ 'Response size exceeded'
936
+ )
937
+ }
938
+
939
+ this.bytesRead += len
940
+
941
+ const buffer = currentBufferRef
942
+ if (
943
+ request.onResponseData(
944
+ new FastBuffer(buffer.buffer, buffer.byteOffset + at, len)
945
+ ) === false
946
+ ) {
947
+ this.pauseParser()
948
+ this[kPausedByHandler] = true
949
+ }
950
+
951
+ break
952
+ }
953
+ case milo.EVENT_TRAILER_NAME: {
954
+ const at = this.parserEvents.readUInt32LE(cursor + 1)
955
+ const len = this.parserEvents.readUInt32LE(cursor + 5)
956
+ const data =
957
+ len > 0
958
+ ? new FastBuffer(
959
+ currentBufferRef.buffer,
960
+ currentBufferRef.byteOffset + at,
961
+ len
962
+ )
963
+ : EMPTY_BUF
964
+
965
+ this.trailers.push(data)
966
+
967
+ this.trailersSize += len
968
+ if (this.trailersSize >= this.headersMaxSize) {
969
+ util.destroy(this.socket, new HeadersOverflowError())
970
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Headers overflow')
971
+ }
972
+
973
+ break
974
+ }
975
+ case milo.EVENT_TRAILER_VALUE: {
976
+ const at = this.parserEvents.readUInt32LE(cursor + 1)
977
+ const len = this.parserEvents.readUInt32LE(cursor + 5)
978
+ const data =
979
+ len > 0
980
+ ? new FastBuffer(
981
+ currentBufferRef.buffer,
982
+ currentBufferRef.byteOffset + at,
983
+ len
984
+ )
985
+ : EMPTY_BUF
986
+
987
+ this.trailers.push(data)
988
+
989
+ this.trailersSize += len
990
+ if (this.trailersSize >= this.headersMaxSize) {
991
+ util.destroy(this.socket, new HeadersOverflowError())
992
+ return this.fail(milo.ERROR_CALLBACK_ERROR, 'Headers overflow')
993
+ }
994
+
995
+ break
996
+ }
997
+ default:
998
+ return
999
+ }
1000
+
1001
+ cursor += eventLen
1002
+ }
1003
+ }
1004
+
1005
+ fail (code, message) {
1006
+ this.milo.fail(this.parser, code, message)
1007
+ this.errored = true
1008
+ }
1009
+
1010
+ onUpgrade (head) {
1011
+ const { upgrade, client, socket, headers, statusCode } = this
1012
+
1013
+ assert(upgrade)
1014
+ assert(client[kSocket] === socket)
1015
+ assert(!socket.destroyed)
1016
+ assert(!this.paused)
1017
+
1018
+ const request = client[kQueue][client[kRunningIdx]]
1019
+ assert(request)
1020
+ assert(request.upgrade || request.method === 'CONNECT')
1021
+
1022
+ this.statusCode = 0
1023
+ this.statusText = ''
1024
+ this.shouldKeepAlive = false
1025
+ this.headers = []
1026
+ this.headersSize = 0
1027
+
1028
+ socket.unshift(head)
1029
+ socket[kParser].destroy()
1030
+ socket[kParser] = null
1031
+ socket[kClient] = null
1032
+ socket[kError] = null
1033
+
1034
+ removeAllListeners(socket)
1035
+
1036
+ client[kSocket] = null
1037
+ client[kHTTPContext] = null
1038
+ client[kQueue][client[kRunningIdx]++] = null
1039
+ client.emit(
1040
+ 'disconnect',
1041
+ client[kUrl],
1042
+ [client],
1043
+ new InformationalError('upgrade')
1044
+ )
1045
+
1046
+ try {
1047
+ request.onRequestUpgrade(statusCode, headers, socket)
1048
+ } catch (err) {
1049
+ util.destroy(socket, err)
1050
+ }
1051
+
1052
+ client[kResume]()
1053
+ }
1054
+ }
1055
+
1056
+ function setMiloEnabled (value) {
1057
+ miloEnabled = value
1058
+ }
1059
+
1060
+ function getMiloEnabled () {
1061
+ return miloEnabled
1062
+ }
1063
+
1064
+ module.exports = { H1Parser, getMiloEnabled, setMiloEnabled }