@anhdhbn/9router 0.5.116 → 0.5.119

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 (738) hide show
  1. package/README.md +19 -47
  2. package/app/.next-cli-build/BUILD_ID +1 -1
  3. package/app/.next-cli-build/app-path-routes-manifest.json +15 -15
  4. package/app/.next-cli-build/build-manifest.json +2 -2
  5. package/app/.next-cli-build/prerender-manifest.json +6 -6
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +12 -12
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  78. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  83. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  85. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  86. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  87. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  88. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  89. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  102. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  104. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  107. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  109. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
  111. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  115. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  123. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
  125. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
  131. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  133. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  138. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  140. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
  142. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  144. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  146. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  152. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  154. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  171. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  181. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/commandcode/auto-import/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  204. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  209. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +1 -1
  212. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  221. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  224. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  226. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  237. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  240. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  242. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/providers/web-login/route.js +1 -1
  244. package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  264. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  276. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  278. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  280. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  284. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  288. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  290. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  299. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  300. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  303. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +4 -4
  309. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +3 -3
  317. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  320. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  321. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  322. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  324. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  326. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  327. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  328. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  330. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  332. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  334. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  336. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  337. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  338. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  339. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  340. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  342. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  344. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  346. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  347. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  348. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  350. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  351. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  352. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  353. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  354. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  356. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  358. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  359. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  360. package/app/.next-cli-build/server/app/callback.html +1 -1
  361. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  362. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  363. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  364. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
  365. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  366. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +3 -3
  367. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +3 -3
  368. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +3 -3
  369. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  370. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  371. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  372. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +6 -6
  373. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  374. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  375. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  376. package/app/.next-cli-build/server/app/dashboard/combos.rsc +3 -3
  377. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +3 -3
  378. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +3 -3
  379. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  380. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  381. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +3 -3
  382. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
  383. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +3 -3
  384. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  385. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  386. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +3 -3
  387. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +3 -3
  388. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +3 -3
  389. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  390. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  391. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  392. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +6 -6
  393. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  394. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  395. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  396. package/app/.next-cli-build/server/app/dashboard/profile.rsc +3 -3
  397. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +3 -3
  398. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +3 -3
  399. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  400. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  401. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +3 -3
  402. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +3 -3
  403. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +3 -3
  404. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  405. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  406. package/app/.next-cli-build/server/app/dashboard/providers.rsc +3 -3
  407. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +3 -3
  408. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +3 -3
  409. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  410. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  411. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
  412. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +5 -5
  413. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  414. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  415. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  416. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +3 -3
  417. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +3 -3
  418. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +3 -3
  419. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  420. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  421. package/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
  422. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
  423. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
  424. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  425. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  426. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  427. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  428. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  429. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  430. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  431. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  432. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
  433. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  434. package/app/.next-cli-build/server/app/dashboard/skills.rsc +3 -3
  435. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +3 -3
  436. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +3 -3
  437. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  438. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  439. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +3 -3
  440. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +3 -3
  441. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +3 -3
  442. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  443. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  444. package/app/.next-cli-build/server/app/dashboard/translator.rsc +3 -3
  445. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +3 -3
  446. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +3 -3
  447. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  448. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  449. package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  450. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +5 -5
  451. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  452. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  453. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  454. package/app/.next-cli-build/server/app/dashboard.rsc +3 -3
  455. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +3 -3
  456. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +3 -3
  457. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  458. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  459. package/app/.next-cli-build/server/app/index.html +1 -1
  460. package/app/.next-cli-build/server/app/index.rsc +3 -3
  461. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  462. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  463. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  464. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  465. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  466. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  467. package/app/.next-cli-build/server/app/landing.html +1 -1
  468. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  469. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  470. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  471. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
  472. package/app/.next-cli-build/server/app/login/page.js +1 -1
  473. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  474. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  475. package/app/.next-cli-build/server/app/login.html +1 -1
  476. package/app/.next-cli-build/server/app/login.rsc +3 -3
  477. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  478. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  479. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
  480. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  481. package/app/.next-cli-build/server/app/page.js +1 -1
  482. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  483. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  484. package/app/.next-cli-build/server/app-paths-manifest.json +15 -15
  485. package/app/.next-cli-build/server/chunks/1051.js +1 -1
  486. package/app/.next-cli-build/server/chunks/{9999.js → 1297.js} +2 -2
  487. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  488. package/app/.next-cli-build/server/chunks/{4597.js → 1568.js} +1 -1
  489. package/app/.next-cli-build/server/chunks/1757.js +1 -1
  490. package/app/.next-cli-build/server/chunks/24.js +1 -1
  491. package/app/.next-cli-build/server/chunks/2840.js +1 -0
  492. package/app/.next-cli-build/server/chunks/3225.js +1 -1
  493. package/app/.next-cli-build/server/chunks/3697.js +1 -1
  494. package/app/.next-cli-build/server/chunks/3885.js +1 -1
  495. package/app/.next-cli-build/server/chunks/3943.js +1 -1
  496. package/app/.next-cli-build/server/chunks/412.js +5 -5
  497. package/app/.next-cli-build/server/chunks/4123.js +1 -1
  498. package/app/.next-cli-build/server/chunks/4882.js +1 -1
  499. package/app/.next-cli-build/server/chunks/{3783.js → 5299.js} +4 -4
  500. package/app/.next-cli-build/server/chunks/5330.js +34 -34
  501. package/app/.next-cli-build/server/chunks/5485.js +1 -1
  502. package/app/.next-cli-build/server/chunks/5615.js +1 -1
  503. package/app/.next-cli-build/server/chunks/5932.js +1 -0
  504. package/app/.next-cli-build/server/chunks/6054.js +1 -1
  505. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  506. package/app/.next-cli-build/server/chunks/615.js +1 -1
  507. package/app/.next-cli-build/server/chunks/6297.js +1 -0
  508. package/app/.next-cli-build/server/chunks/6513.js +1 -1
  509. package/app/.next-cli-build/server/chunks/6576.js +1 -0
  510. package/app/.next-cli-build/server/chunks/6690.js +1 -1
  511. package/app/.next-cli-build/server/chunks/6724.js +1 -1
  512. package/app/.next-cli-build/server/chunks/6763.js +1 -1
  513. package/app/.next-cli-build/server/chunks/7114.js +1 -1
  514. package/app/.next-cli-build/server/chunks/7187.js +1 -1
  515. package/app/.next-cli-build/server/chunks/7247.js +1 -1
  516. package/app/.next-cli-build/server/chunks/7373.js +1 -1
  517. package/app/.next-cli-build/server/chunks/7525.js +1 -1
  518. package/app/.next-cli-build/server/chunks/7552.js +1 -1
  519. package/app/.next-cli-build/server/chunks/7716.js +1 -1
  520. package/app/.next-cli-build/server/chunks/778.js +1 -1
  521. package/app/.next-cli-build/server/chunks/7843.js +51 -0
  522. package/app/.next-cli-build/server/chunks/8251.js +1 -1
  523. package/app/.next-cli-build/server/chunks/8402.js +1 -1
  524. package/app/.next-cli-build/server/chunks/8623.js +1 -1
  525. package/app/.next-cli-build/server/chunks/866.js +1 -0
  526. package/app/.next-cli-build/server/chunks/869.js +1 -1
  527. package/app/.next-cli-build/server/chunks/8895.js +3 -3
  528. package/app/.next-cli-build/server/chunks/8896.js +1 -1
  529. package/app/.next-cli-build/server/chunks/8920.js +1 -1
  530. package/app/.next-cli-build/server/chunks/8994.js +1 -1
  531. package/app/.next-cli-build/server/chunks/9198.js +1 -0
  532. package/app/.next-cli-build/server/chunks/9609.js +1 -1
  533. package/app/.next-cli-build/server/chunks/9927.js +1 -1
  534. package/app/.next-cli-build/server/instrumentation.js +1 -1
  535. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  536. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  537. package/app/.next-cli-build/server/middleware.js +3 -3
  538. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  539. package/app/.next-cli-build/server/pages/404.html +1 -1
  540. package/app/.next-cli-build/server/pages/500.html +1 -1
  541. package/app/.next-cli-build/server/preview-props.json +3 -3
  542. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  543. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  544. package/app/.next-cli-build/static/chunks/1321-2fde166305caeddb.js +1 -0
  545. package/app/.next-cli-build/static/chunks/5497-832391bf809808e3.js +7 -0
  546. package/app/.next-cli-build/static/chunks/{9134-dce513bebf49f409.js → 761-32ad2b1ee5ca216d.js} +10 -10
  547. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-a1c51b0c7ad758ad.js → page-6abc904471ca5d9e.js} +1 -1
  548. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-407f76834b37cd6c.js → page-1f2d3a8531261f5a.js} +1 -1
  549. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-a09d4b437dec0273.js → page-624cd614b7bc1f8c.js} +11 -11
  550. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-f9f9e895a365e8d3.js → page-9ee6ec1d1ae265b8.js} +1 -1
  551. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-efdb4d5aacfda8a6.js +27 -0
  552. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-371203e00dbb386a.js +4 -0
  553. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-cb6752cc71bde85f.js → page-98e943d2e0230bb1.js} +1 -1
  554. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-9121f5a9bc6ae4d6.js +1 -0
  555. package/app/node_modules/undici/README.md +29 -116
  556. package/app/node_modules/undici/docs/docs/api/Agent.md +42 -249
  557. package/app/node_modules/undici/docs/docs/api/BalancedPool.md +48 -246
  558. package/app/node_modules/undici/docs/docs/api/CacheStorage.md +13 -171
  559. package/app/node_modules/undici/docs/docs/api/CacheStore.md +98 -309
  560. package/app/node_modules/undici/docs/docs/api/Client.md +164 -412
  561. package/app/node_modules/undici/docs/docs/api/ClientStats.md +14 -80
  562. package/app/node_modules/undici/docs/docs/api/Connector.md +35 -118
  563. package/app/node_modules/undici/docs/docs/api/ContentType.md +25 -65
  564. package/app/node_modules/undici/docs/docs/api/Cookies.md +71 -122
  565. package/app/node_modules/undici/docs/docs/api/Debug.md +18 -34
  566. package/app/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +167 -368
  567. package/app/node_modules/undici/docs/docs/api/Dispatcher.md +1056 -505
  568. package/app/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +93 -105
  569. package/app/node_modules/undici/docs/docs/api/Errors.md +28 -603
  570. package/app/node_modules/undici/docs/docs/api/EventSource.md +13 -326
  571. package/app/node_modules/undici/docs/docs/api/Fetch.md +30 -691
  572. package/app/node_modules/undici/docs/docs/api/GlobalInstallation.md +96 -78
  573. package/app/node_modules/undici/docs/docs/api/H2CClient.md +176 -299
  574. package/app/node_modules/undici/docs/docs/api/MockAgent.md +314 -333
  575. package/app/node_modules/undici/docs/docs/api/MockCallHistory.md +98 -272
  576. package/app/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +26 -189
  577. package/app/node_modules/undici/docs/docs/api/MockClient.md +33 -151
  578. package/app/node_modules/undici/docs/docs/api/MockErrors.md +5 -56
  579. package/app/node_modules/undici/docs/docs/api/MockPool.md +258 -321
  580. package/app/node_modules/undici/docs/docs/api/Pool.md +41 -235
  581. package/app/node_modules/undici/docs/docs/api/PoolStats.md +13 -119
  582. package/app/node_modules/undici/docs/docs/api/ProxyAgent.md +160 -179
  583. package/app/node_modules/undici/docs/docs/api/RedirectHandler.md +55 -241
  584. package/app/node_modules/undici/docs/docs/api/RetryAgent.md +27 -113
  585. package/app/node_modules/undici/docs/docs/api/RetryHandler.md +79 -161
  586. package/app/node_modules/undici/docs/docs/api/RoundRobinPool.md +72 -166
  587. package/app/node_modules/undici/docs/docs/api/SnapshotAgent.md +517 -262
  588. package/app/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +196 -177
  589. package/app/node_modules/undici/docs/docs/api/Util.md +11 -68
  590. package/app/node_modules/undici/docs/docs/api/WebSocket.md +80 -475
  591. package/app/node_modules/undici/docs/docs/api/api-lifecycle.md +32 -100
  592. package/app/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -2
  593. package/app/node_modules/undici/docs/docs/best-practices/crawling.md +1 -3
  594. package/app/node_modules/undici/docs/docs/best-practices/mocking-request.md +7 -9
  595. package/app/node_modules/undici/docs/docs/best-practices/proxy.md +1 -3
  596. package/app/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +8 -10
  597. package/app/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -2
  598. package/app/node_modules/undici/index.js +2 -4
  599. package/app/node_modules/undici/lib/api/api-connect.js +11 -13
  600. package/app/node_modules/undici/lib/api/api-pipeline.js +13 -26
  601. package/app/node_modules/undici/lib/api/api-request.js +21 -51
  602. package/app/node_modules/undici/lib/api/api-stream.js +20 -81
  603. package/app/node_modules/undici/lib/api/api-upgrade.js +11 -21
  604. package/app/node_modules/undici/lib/api/readable.js +11 -46
  605. package/app/node_modules/undici/lib/cache/memory-cache-store.js +15 -50
  606. package/app/node_modules/undici/lib/cache/sqlite-cache-store.js +18 -142
  607. package/app/node_modules/undici/lib/core/connect.js +7 -46
  608. package/app/node_modules/undici/lib/core/constants.js +23 -11
  609. package/app/node_modules/undici/lib/core/errors.js +3 -60
  610. package/app/node_modules/undici/lib/core/request.js +19 -116
  611. package/app/node_modules/undici/lib/core/symbols.js +0 -5
  612. package/app/node_modules/undici/lib/core/util.js +88 -110
  613. package/app/node_modules/undici/lib/dispatcher/agent.js +32 -51
  614. package/app/node_modules/undici/lib/dispatcher/balanced-pool.js +27 -23
  615. package/app/node_modules/undici/lib/dispatcher/client-h1.js +89 -166
  616. package/app/node_modules/undici/lib/dispatcher/client-h2.js +373 -1306
  617. package/app/node_modules/undici/lib/dispatcher/client.js +34 -114
  618. package/app/node_modules/undici/lib/dispatcher/dispatcher-base.js +8 -10
  619. package/app/node_modules/undici/lib/dispatcher/dispatcher.js +5 -15
  620. package/app/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +13 -57
  621. package/app/node_modules/undici/lib/dispatcher/h2c-client.js +4 -4
  622. package/app/node_modules/undici/lib/dispatcher/pool-base.js +27 -160
  623. package/app/node_modules/undici/lib/dispatcher/pool.js +16 -127
  624. package/app/node_modules/undici/lib/dispatcher/proxy-agent.js +29 -128
  625. package/app/node_modules/undici/lib/dispatcher/retry-agent.js +0 -13
  626. package/app/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -47
  627. package/app/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +63 -153
  628. package/app/node_modules/undici/lib/global.js +14 -37
  629. package/app/node_modules/undici/lib/handler/cache-handler.js +60 -101
  630. package/app/node_modules/undici/lib/handler/cache-revalidation-handler.js +0 -10
  631. package/app/node_modules/undici/lib/handler/decorator-handler.js +5 -14
  632. package/app/node_modules/undici/lib/handler/deduplication-handler.js +38 -74
  633. package/app/node_modules/undici/lib/handler/redirect-handler.js +72 -83
  634. package/app/node_modules/undici/lib/handler/retry-handler.js +45 -227
  635. package/app/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
  636. package/app/node_modules/undici/lib/handler/wrap-handler.js +105 -0
  637. package/app/node_modules/undici/lib/interceptor/cache.js +28 -53
  638. package/app/node_modules/undici/lib/interceptor/decompress.js +5 -12
  639. package/app/node_modules/undici/lib/interceptor/deduplicate.js +4 -5
  640. package/app/node_modules/undici/lib/interceptor/dns.js +1 -23
  641. package/app/node_modules/undici/lib/interceptor/redirect.js +3 -3
  642. package/app/node_modules/undici/lib/interceptor/response-error.js +28 -72
  643. package/app/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  644. package/app/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -1
  645. package/app/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -1
  646. package/app/node_modules/undici/lib/mock/mock-agent.js +9 -32
  647. package/app/node_modules/undici/lib/mock/mock-call-history.js +1 -1
  648. package/app/node_modules/undici/lib/mock/mock-interceptor.js +7 -25
  649. package/app/node_modules/undici/lib/mock/mock-utils.js +48 -292
  650. package/app/node_modules/undici/lib/mock/snapshot-agent.js +7 -25
  651. package/app/node_modules/undici/lib/mock/snapshot-recorder.js +5 -41
  652. package/app/node_modules/undici/lib/mock/snapshot-utils.js +2 -3
  653. package/app/node_modules/undici/lib/util/cache.js +14 -69
  654. package/app/node_modules/undici/lib/util/promise.js +28 -0
  655. package/app/node_modules/undici/lib/util/runtime-features.js +34 -3
  656. package/app/node_modules/undici/lib/web/cache/cache.js +16 -23
  657. package/app/node_modules/undici/lib/web/cache/cachestorage.js +5 -11
  658. package/app/node_modules/undici/lib/web/cookies/index.js +6 -16
  659. package/app/node_modules/undici/lib/web/cookies/parse.js +4 -7
  660. package/app/node_modules/undici/lib/web/cookies/util.js +1 -1
  661. package/app/node_modules/undici/lib/web/eventsource/eventsource.js +23 -66
  662. package/app/node_modules/undici/lib/web/eventsource/util.js +1 -32
  663. package/app/node_modules/undici/lib/web/fetch/body.js +25 -90
  664. package/app/node_modules/undici/lib/web/fetch/constants.js +1 -1
  665. package/app/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  666. package/app/node_modules/undici/lib/web/fetch/formdata-parser.js +4 -12
  667. package/app/node_modules/undici/lib/web/fetch/formdata.js +26 -39
  668. package/app/node_modules/undici/lib/web/fetch/headers.js +33 -36
  669. package/app/node_modules/undici/lib/web/fetch/index.js +259 -297
  670. package/app/node_modules/undici/lib/web/fetch/request.js +170 -172
  671. package/app/node_modules/undici/lib/web/fetch/response.js +47 -44
  672. package/app/node_modules/undici/lib/web/fetch/util.js +9 -17
  673. package/app/node_modules/undici/lib/web/infra/index.js +14 -15
  674. package/app/node_modules/undici/lib/web/webidl/index.js +21 -7
  675. package/app/node_modules/undici/lib/web/websocket/connection.js +5 -16
  676. package/app/node_modules/undici/lib/web/websocket/events.js +26 -43
  677. package/app/node_modules/undici/lib/web/websocket/frame.js +7 -1
  678. package/app/node_modules/undici/lib/web/websocket/receiver.js +3 -13
  679. package/app/node_modules/undici/lib/web/websocket/stream/websocketerror.js +10 -13
  680. package/app/node_modules/undici/lib/web/websocket/stream/websocketstream.js +14 -29
  681. package/app/node_modules/undici/lib/web/websocket/websocket.js +40 -65
  682. package/app/node_modules/undici/package.json +13 -15
  683. package/app/node_modules/undici/types/agent.d.ts +2 -0
  684. package/app/node_modules/undici/types/api.d.ts +1 -1
  685. package/app/node_modules/undici/types/cache-interceptor.d.ts +0 -10
  686. package/app/node_modules/undici/types/client.d.ts +27 -64
  687. package/app/node_modules/undici/types/connector.d.ts +0 -1
  688. package/app/node_modules/undici/types/cookies.d.ts +1 -1
  689. package/app/node_modules/undici/types/diagnostics-channel.d.ts +1 -2
  690. package/app/node_modules/undici/types/dispatcher.d.ts +30 -8
  691. package/app/node_modules/undici/types/errors.d.ts +1 -26
  692. package/app/node_modules/undici/types/fetch.d.ts +1 -5
  693. package/app/node_modules/undici/types/formdata.d.ts +12 -6
  694. package/app/node_modules/undici/types/h2c-client.d.ts +7 -7
  695. package/app/node_modules/undici/types/handlers.d.ts +0 -2
  696. package/app/node_modules/undici/types/header.d.ts +0 -5
  697. package/app/node_modules/undici/types/index.d.ts +1 -3
  698. package/app/node_modules/undici/types/interceptors.d.ts +2 -7
  699. package/app/node_modules/undici/types/mock-agent.d.ts +10 -11
  700. package/app/node_modules/undici/types/mock-interceptor.d.ts +1 -5
  701. package/app/node_modules/undici/types/pool.d.ts +2 -0
  702. package/app/node_modules/undici/types/proxy-agent.d.ts +2 -9
  703. package/app/node_modules/undici/types/retry-handler.d.ts +3 -3
  704. package/app/node_modules/undici/types/round-robin-pool.d.ts +2 -0
  705. package/app/node_modules/undici/types/snapshot-agent.d.ts +0 -4
  706. package/app/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -4
  707. package/app/node_modules/undici/types/utility.d.ts +4 -4
  708. package/app/node_modules/undici/types/webidl.d.ts +8 -13
  709. package/app/package.json +5 -2
  710. package/app/public/providers/sensenova-intl.png +0 -0
  711. package/app/src/shared/services/quotaAutoPing.js +17 -2
  712. package/package.json +2 -2
  713. package/app/.next-cli-build/server/chunks/1004.js +0 -1
  714. package/app/.next-cli-build/server/chunks/4480.js +0 -1
  715. package/app/.next-cli-build/server/chunks/4811.js +0 -51
  716. package/app/.next-cli-build/server/chunks/547.js +0 -1
  717. package/app/.next-cli-build/server/chunks/7573.js +0 -1
  718. package/app/.next-cli-build/server/chunks/8499.js +0 -1
  719. package/app/.next-cli-build/server/chunks/9102.js +0 -1
  720. package/app/.next-cli-build/static/chunks/1321-93eb6ca56f8fcb1e.js +0 -1
  721. package/app/.next-cli-build/static/chunks/5497-02b05d77d17bcdc3.js +0 -7
  722. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-74ca3f1d4f1ec046.js +0 -27
  723. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-b44167799c6c673a.js +0 -4
  724. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-f16fd9091b7ae81c.js +0 -1
  725. package/app/node_modules/undici/docs/docs/api/Interceptors.md +0 -439
  726. package/app/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +0 -233
  727. package/app/node_modules/undici/docs/docs/getting-started.md +0 -281
  728. package/app/node_modules/undici/docs/docs/index.md +0 -793
  729. package/app/node_modules/undici/docs/docs/site.json +0 -125
  730. package/app/node_modules/undici/docs/docs/type-map.json +0 -79
  731. package/app/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +0 -127
  732. package/app/node_modules/undici/lib/dispatcher/parser-h1.js +0 -1065
  733. package/app/node_modules/undici/lib/milo/LICENSE.md +0 -7
  734. package/app/node_modules/undici/lib/milo/no-simd.js +0 -1002
  735. package/app/node_modules/undici/lib/milo/simd.js +0 -1002
  736. package/app/node_modules/undici/types/dispatcher1-wrapper.d.ts +0 -7
  737. /package/app/.next-cli-build/static/{erY6mcU6WqDeuYANqpCwQ → mEL-faV-rpAwzfhUdVe-c}/_buildManifest.js +0 -0
  738. /package/app/.next-cli-build/static/{erY6mcU6WqDeuYANqpCwQ → mEL-faV-rpAwzfhUdVe-c}/_ssgManifest.js +0 -0
@@ -5,14 +5,12 @@ const { pipeline } = require('node:stream')
5
5
  const util = require('../core/util.js')
6
6
  const {
7
7
  RequestContentLengthMismatchError,
8
- ResponseContentLengthMismatchError,
9
8
  RequestAbortedError,
10
9
  SocketError,
11
10
  InformationalError,
12
11
  InvalidArgumentError,
13
12
  HeadersTimeoutError,
14
- BodyTimeoutError,
15
- ResponseExceededMaxSizeError
13
+ BodyTimeoutError
16
14
  } = require('../core/errors.js')
17
15
  const {
18
16
  kUrl,
@@ -28,46 +26,24 @@ const {
28
26
  kStrictContentLength,
29
27
  kOnError,
30
28
  kMaxConcurrentStreams,
29
+ kPingInterval,
31
30
  kHTTP2Session,
32
- kHostAuthority,
31
+ kHTTP2InitialWindowSize,
32
+ kHTTP2ConnectionWindowSize,
33
33
  kResume,
34
34
  kSize,
35
35
  kHTTPContext,
36
36
  kClosed,
37
- kKeepAliveDefaultTimeout,
38
- kHeadersTimeout,
39
37
  kBodyTimeout,
38
+ kHeadersTimeout,
40
39
  kEnableConnectProtocol,
41
40
  kRemoteSettings,
42
41
  kHTTP2Stream,
43
- kHTTP2SessionState,
44
- kHTTP2Options,
45
- kMaxResponseSize
42
+ kHTTP2SessionState
46
43
  } = require('../core/symbols.js')
47
44
  const { channels } = require('../core/diagnostics.js')
48
45
 
49
46
  const kOpenStreams = Symbol('open streams')
50
- const kRequestStream = Symbol('request stream')
51
- const kRequestStreamCleanup = Symbol('request stream cleanup')
52
- const kRequestStreamState = Symbol('request stream state')
53
- const kReceivedGoAway = Symbol('received goaway')
54
- const kGoAwayReplayAttempts = Symbol('goaway replay attempts')
55
- const kRefusedStreamRetry = Symbol('refused stream retry')
56
-
57
- // RFC 9113 section 8.7: a client SHOULD NOT automatically retry a request more
58
- // than once. Without a budget a peer that keeps refusing turns one request into
59
- // an unbounded connect/refuse/reconnect loop that never settles and starves the
60
- // event loop.
61
- const MAX_GOAWAY_REPLAY_ATTEMPTS = 1
62
-
63
- // RFC 9113 section 6.2. node:http2 reports frame types as raw numbers.
64
- const HTTP2_FRAME_TYPE_HEADERS = 1
65
-
66
- // Lower bound on how long a liveness PING may take to be acked. Stream
67
- // timeouts can be tiny (tens of ms), while an ack on a live connection can take
68
- // longer than that on a loaded event loop; without a floor a slow but healthy
69
- // connection would be torn down.
70
- const MIN_PROBE_TIMEOUT = 1e3
71
47
 
72
48
  let extractBody
73
49
 
@@ -90,191 +66,40 @@ const {
90
66
  HTTP2_HEADER_EXPECT,
91
67
  HTTP2_HEADER_STATUS,
92
68
  HTTP2_HEADER_PROTOCOL,
93
- NGHTTP2_NO_ERROR,
94
- NGHTTP2_REFUSED_STREAM
69
+ NGHTTP2_REFUSED_STREAM,
70
+ NGHTTP2_CANCEL
95
71
  }
96
72
  } = http2
97
73
 
98
- function getGoAwayError (session, errorCode) {
99
- return session[kError] ||
100
- (errorCode === NGHTTP2_NO_ERROR
101
- ? new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${errorCode}`)
102
- : new SocketError(`HTTP/2: "GOAWAY" frame received with code ${errorCode}`, util.getSocketInfo(session[kSocket])))
103
- }
104
-
105
- function resetHttp2Session (session, err) {
106
- const client = session[kClient]
107
- const socket = session[kSocket]
108
-
109
- if (client[kHTTP2Session] === session) {
110
- client[kSocket] = null
111
- client[kHTTPContext] = null
112
- client[kHTTP2Session] = null
113
- }
114
-
115
- if (socket != null && socket[kError] == null) {
116
- socket[kError] = err
117
- }
118
-
119
- if (!session.closed && !session.destroyed) {
120
- try {
121
- session.destroy(err)
122
- } catch {}
123
- }
124
-
125
- util.destroy(socket, err)
126
- }
127
-
128
- function getGoAwayPendingIdx (client, lastStreamID) {
129
- const maxAcceptedStreamID = Number.isInteger(lastStreamID) ? lastStreamID : Number.MAX_SAFE_INTEGER
130
-
131
- for (let i = client[kRunningIdx]; i < client[kPendingIdx]; i++) {
132
- const request = client[kQueue][i]
133
-
134
- if (request == null) {
135
- continue
136
- }
137
-
138
- // A pending stream may not have had an ID when it was bound to the request.
139
- const streamId = request[kRequestStream]?.id
140
- if (typeof streamId !== 'number' || streamId > maxAcceptedStreamID) {
141
- return i
74
+ function parseH2Headers (headers) {
75
+ const result = []
76
+
77
+ for (const [name, value] of Object.entries(headers)) {
78
+ // h2 may concat the header value by array
79
+ // e.g. Set-Cookie
80
+ if (Array.isArray(value)) {
81
+ for (const subvalue of value) {
82
+ // we need to provide each header value of header name
83
+ // because the headers handler expect name-value pair
84
+ result.push(Buffer.from(name), Buffer.from(subvalue))
85
+ }
86
+ } else {
87
+ result.push(Buffer.from(name), Buffer.from(value))
142
88
  }
143
89
  }
144
90
 
145
- return client[kPendingIdx]
146
- }
147
-
148
- function detachRequestFromStream (request) {
149
- request[kRequestStream] = null
150
- request[kRequestStreamCleanup] = null
151
- }
152
-
153
- function bindRequestToStream (request, stream, cleanup) {
154
- const previousCleanup = request[kRequestStreamCleanup]
155
- const previousStream = request[kRequestStream]
156
- detachRequestFromStream(request)
157
- previousCleanup?.(previousStream)
158
- request[kRequestStream] = stream
159
- request[kRequestStreamCleanup] = cleanup
160
- }
161
-
162
- function clearRequestStream (request) {
163
- const cleanup = request[kRequestStreamCleanup]
164
- const stream = request[kRequestStream]
165
- detachRequestFromStream(request)
166
- cleanup?.(stream)
167
- }
168
-
169
- function requeueUnsentRequest (client, request) {
170
- client[kQueue].splice(client[kPendingIdx] + 1, 0, request)
171
- }
172
-
173
- function completeRequest (client, request, resetPendingIdx = false) {
174
- const queue = client[kQueue]
175
- const runningIdx = client[kRunningIdx]
176
-
177
- // In-order completion: clear the request and advance without splicing.
178
- // The client's resume loop compacts cleared slots once the index grows.
179
- if (runningIdx < client[kPendingIdx] && queue[runningIdx] === request) {
180
- queue[runningIdx] = null
181
- client[kRunningIdx] = runningIdx + 1
182
- return
183
- }
184
-
185
- const index = queue.indexOf(request, runningIdx)
186
-
187
- if (index === -1 || index >= client[kPendingIdx]) {
188
- return
189
- }
190
-
191
- queue.splice(index, 1)
192
- client[kPendingIdx]--
193
-
194
- if (resetPendingIdx && client[kPendingIdx] < client[kRunningIdx]) {
195
- client[kPendingIdx] = client[kRunningIdx]
196
- }
197
- }
198
-
199
- function canReplayRequest (request) {
200
- const { body } = request
201
-
202
- return body == null || util.isBuffer(body) || util.isBlobLike(body)
203
- }
204
-
205
- function hasResponseStarted (request) {
206
- const state = request[kRequestStream]?.[kRequestStreamState]
207
- return state?.responseReceived === true
208
- }
209
-
210
- // Count a GOAWAY refusal against the request's replay budget. A peer that
211
- // refuses every connection must eventually surface an error to the caller
212
- // rather than being retried forever. Kept separate from canReplayRequest so
213
- // that the REFUSED_STREAM retry, which has its own single-attempt limit, does
214
- // not consume this budget just by asking whether the body can be replayed.
215
- function registerGoAwayRefusal (request) {
216
- const attempts = (request[kGoAwayReplayAttempts] ?? 0) + 1
217
- request[kGoAwayReplayAttempts] = attempts
218
-
219
- return attempts <= MAX_GOAWAY_REPLAY_ATTEMPTS
220
- }
221
-
222
- function closeStream (stream, code = NGHTTP2_REFUSED_STREAM) {
223
- if (stream != null && !stream.destroyed && !stream.closed) {
224
- try {
225
- stream.close(code)
226
- } catch {}
227
- }
228
- }
229
-
230
- function detachRequestStreamForClose (request) {
231
- const stream = request[kRequestStream]
232
-
233
- clearRequestStream(request)
234
- severRequestStream(stream)
235
-
236
- return stream
237
- }
238
-
239
- // Unbind a stream from its request for good. releaseRequestStream() alone
240
- // leaves the 'close' listener attached and kRequestStreamState populated, so a
241
- // stream abandoned here would still run completeRequestStream() later — and
242
- // splice out the request that has since been requeued onto another session.
243
- function severRequestStream (stream) {
244
- if (stream == null || stream[kRequestStreamState] == null) {
245
- return
246
- }
247
-
248
- stream[kRequestStreamState] = null
249
- stream.off('close', completeRequestStream)
250
- // Upgrade streams use their own close cleanup, which would otherwise release
251
- // the session a second time after the stream has been severed for GOAWAY.
252
- stream.off('close', onUpgradeStreamClose)
253
-
254
- if (stream[kHTTP2Session] != null) {
255
- closeStreamSession(stream)
256
- }
257
-
258
- // #5936: Node can still deliver a session-level error to a native stream
259
- // after undici has stopped tracking it (e.g. on idle session teardown). Keep
260
- // a persistent noop error sink so the 'error' event is never emitted with no
261
- // listener, which would crash the process. A single sink is enough even if
262
- // one was already attached by the onError path, so clear it first.
263
- if (!stream.destroyed && !stream.closed) {
264
- stream.off('error', noop)
265
- stream.on('error', noop)
266
- }
91
+ return result
267
92
  }
268
93
 
269
94
  function connectH2 (client, socket) {
270
95
  client[kSocket] = socket
271
96
 
272
- const http2InitialWindowSize = client[kHTTP2Options].sessionOptions?.initialWindowSize
273
- const http2ConnectionWindowSize = client[kHTTP2Options].connectionWindowSize
97
+ const http2InitialWindowSize = client[kHTTP2InitialWindowSize]
98
+ const http2ConnectionWindowSize = client[kHTTP2ConnectionWindowSize]
274
99
 
275
100
  const session = http2.connect(client[kUrl], {
276
101
  createConnection: () => socket,
277
- peerMaxConcurrentStreams: client[kHTTP2Options].maxConcurrentStreams,
102
+ peerMaxConcurrentStreams: client[kMaxConcurrentStreams],
278
103
  settings: {
279
104
  // TODO(metcoder95): add support for PUSH
280
105
  enablePush: false,
@@ -287,23 +112,10 @@ function connectH2 (client, socket) {
287
112
  session[kClient] = client
288
113
  session[kSocket] = socket
289
114
  session[kHTTP2SessionState] = {
290
- idleTimeout: null,
291
- // Armed while the peer advertises MAX_CONCURRENT_STREAMS = 0 and we have
292
- // work that cannot start. See setNoStreamsTimeout.
293
- noStreamsTimeout: null,
294
- // Armed while a PING checks whether the peer is still there after a
295
- // stream timed out. See probeHttp2Session.
296
- probeTimeout: null,
297
- // Sockets start out ref'd. Session ref/unref proxies to the socket, so a
298
- // single cached flag lets us skip redundant uv ref/unref calls, provided
299
- // every ref/unref of the session or its socket goes through
300
- // refH2Session/unrefH2Session.
301
- refed: true,
302
115
  ping: {
303
- interval: client[kHTTP2Options].pingInterval === 0 ? null : setInterval(onHttp2SendPing, client[kHTTP2Options].pingInterval, session).unref()
116
+ interval: client[kPingInterval] === 0 ? null : setInterval(onHttp2SendPing, client[kPingInterval], session).unref()
304
117
  }
305
118
  }
306
- session[kReceivedGoAway] = false
307
119
  // We set it to true by default in a best-effort; however once connected to an H2 server
308
120
  // we will check if extended CONNECT protocol is supported or not
309
121
  // and set this value accordingly.
@@ -318,13 +130,14 @@ function connectH2 (client, socket) {
318
130
 
319
131
  util.addListener(session, 'error', onHttp2SessionError)
320
132
  util.addListener(session, 'frameError', onHttp2FrameError)
133
+ util.addListener(session, 'end', onHttp2SessionEnd)
321
134
  util.addListener(session, 'goaway', onHttp2SessionGoAway)
322
135
  util.addListener(session, 'close', onHttp2SessionClose)
323
136
  util.addListener(session, 'remoteSettings', onHttp2RemoteSettings)
324
137
  // TODO (@metcoder95): implement SETTINGS support
325
138
  // util.addListener(session, 'localSettings', onHttp2RemoteSettings)
326
139
 
327
- unrefH2Session(session)
140
+ session.unref()
328
141
 
329
142
  client[kHTTP2Session] = session
330
143
  socket[kHTTP2Session] = session
@@ -374,30 +187,27 @@ function connectH2 (client, socket) {
374
187
  * @returns {boolean}
375
188
  */
376
189
  busy (request) {
377
- if (session[kRemoteSettings] === false && client[kRunning] > 0) {
378
- return true
379
- }
380
-
381
- // Do not open streams on a connection that may be dead.
382
- if (session[kHTTP2SessionState].probeTimeout != null) {
383
- return true
384
- }
385
-
386
- if (client[kRunning] >= client[kMaxConcurrentStreams]) {
387
- return true
388
- }
389
-
390
190
  if (request != null) {
391
191
  if (client[kRunning] > 0) {
392
192
  // We are already processing requests
393
193
 
394
- // Unlike HTTP/1.1 pipelining, HTTP/2 multiplexes requests on
395
- // independent streams, so non-idempotent requests can be dispatched
396
- // concurrently. Retry eligibility is handled by stream/session error
397
- // handling instead of by serializing all non-idempotent requests.
194
+ // Non-idempotent request cannot be retried.
195
+ // Ensure that no other requests are inflight and
196
+ // could cause failure.
197
+ if (request.idempotent === false) return true
398
198
  // Don't dispatch an upgrade until all preceding requests have completed.
399
199
  // Possibly, we do not have remote settings confirmed yet.
400
200
  if ((request.upgrade === 'websocket' || request.method === 'CONNECT') && session[kRemoteSettings] === false) return true
201
+ // Request with stream or iterator body can error while other requests
202
+ // are inflight and indirectly error those as well.
203
+ // Ensure this doesn't happen by waiting for inflight
204
+ // to complete before dispatching.
205
+
206
+ // Request with stream or iterator body cannot be retried.
207
+ // Ensure that no other requests are inflight and
208
+ // could cause failure.
209
+ if (util.bodyLength(request.body) !== 0 &&
210
+ (util.isStream(request.body) || util.isAsyncIterable(request.body) || util.isFormDataLike(request.body))) return true
401
211
  } else {
402
212
  return (request.upgrade === 'websocket' || request.method === 'CONNECT') && session[kRemoteSettings] === false
403
213
  }
@@ -408,209 +218,22 @@ function connectH2 (client, socket) {
408
218
  }
409
219
  }
410
220
 
411
- // Session ref/unref proxies to the underlying socket, so refH2Session and
412
- // unrefH2Session cover both and can skip the call when the cached ref state
413
- // already matches.
414
- function refH2Session (session) {
415
- const state = session[kHTTP2SessionState]
416
-
417
- if (state.refed === false) {
418
- state.refed = true
419
- session.ref()
420
- }
421
- }
422
-
423
- function unrefH2Session (session) {
424
- const state = session[kHTTP2SessionState]
425
-
426
- if (state.refed === true) {
427
- state.refed = false
428
- session.unref()
429
- }
430
- }
431
-
432
221
  function resumeH2 (client) {
433
222
  const socket = client[kSocket]
434
- const session = client[kHTTP2Session]
435
223
 
436
224
  if (socket?.destroyed === false) {
437
- // After an upgrade the queue is empty but its stream is still in use, so never unref while a stream is open.
438
- if (session[kOpenStreams] === 0 && client[kSize] === 0) {
439
- unrefH2Session(session)
225
+ // Only let the process exit when there is genuinely nothing outstanding.
226
+ // Unreffing because the peer advertised MAX_CONCURRENT_STREAMS = 0 left
227
+ // queued requests with nothing holding the event loop open, so the process
228
+ // could exit with status 0 while an awaited request never settled.
229
+ if (client[kSize] === 0) {
230
+ socket.unref()
231
+ client[kHTTP2Session].unref()
440
232
  } else {
441
- refH2Session(session)
233
+ socket.ref()
234
+ client[kHTTP2Session].ref()
442
235
  }
443
-
444
- if (client[kSize] === 0 && session[kOpenStreams] === 0) {
445
- setHttp2IdleTimeout(session)
446
- } else {
447
- clearHttp2IdleTimeout(session)
448
- }
449
-
450
- if (client[kMaxConcurrentStreams] === 0 && client[kRunning] === 0 && client[kPending] > 0) {
451
- setNoStreamsTimeout(session)
452
- } else {
453
- clearNoStreamsTimeout(session)
454
- }
455
- }
456
- }
457
-
458
- function clearNoStreamsTimeout (session) {
459
- const state = session[kHTTP2SessionState]
460
-
461
- if (state?.noStreamsTimeout != null) {
462
- clearTimeout(state.noStreamsTimeout)
463
- state.noStreamsTimeout = null
464
- }
465
- }
466
-
467
- // A peer is allowed to advertise SETTINGS_MAX_CONCURRENT_STREAMS = 0 to refuse
468
- // new streams (RFC 9113 §6.5.2), and is expected to raise it again later. Until
469
- // it does, busy() reports the client as permanently busy and queued requests
470
- // cannot open a stream — which means no per-stream timeout covers them, and no
471
- // reconnect can happen either, so the SETTINGS frame that would lift the limit
472
- // can never arrive. Give the peer headersTimeout to start honouring requests
473
- // before failing them; a request that cannot even be sent has missed the same
474
- // deadline as one whose headers never arrive.
475
- function setNoStreamsTimeout (session) {
476
- const client = session[kClient]
477
- const state = session[kHTTP2SessionState]
478
- const timeout = client[kHeadersTimeout]
479
-
480
- if (!timeout || state.noStreamsTimeout != null) {
481
- return
482
- }
483
-
484
- state.noStreamsTimeout = setTimeout(onNoStreamsTimeout, timeout, session).unref()
485
- }
486
-
487
- function onNoStreamsTimeout (session) {
488
- const client = session[kClient]
489
- const state = session[kHTTP2SessionState]
490
-
491
- state.noStreamsTimeout = null
492
-
493
- if (
494
- client[kHTTP2Session] !== session ||
495
- client[kMaxConcurrentStreams] !== 0 ||
496
- client[kRunning] !== 0 ||
497
- client[kPending] === 0
498
- ) {
499
- return
500
- }
501
-
502
- const err = new HeadersTimeoutError(
503
- `HTTP/2: server did not accept a new stream within ${client[kHeadersTimeout]}`
504
- )
505
-
506
- const requests = client[kQueue].splice(client[kPendingIdx])
507
- for (let i = 0; i < requests.length; i++) {
508
- if (requests[i] != null) {
509
- util.errorRequest(client, requests[i], err)
510
- }
511
- }
512
-
513
- // Drop the unusable session so the next request gets a fresh connection,
514
- // whose SETTINGS may well allow streams again.
515
- session[kError] = err
516
- resetHttp2Session(session, err)
517
- }
518
-
519
- // A stream timeout only resets that stream, unlike HTTP/1.1 which destroys the
520
- // socket. If the connection itself silently died (dropped by a NAT or load
521
- // balancer, a hung peer), every new stream would time out in turn and the
522
- // session would never be replaced. Ask the peer for a PING ack within the
523
- // timeout that just fired (but at least MIN_PROBE_TIMEOUT): if it answers, only
524
- // that request was slow; if not, drop the session so queued requests move to a
525
- // fresh connection.
526
- function probeHttp2Session (session, timeout) {
527
- const state = session[kHTTP2SessionState]
528
-
529
- if (state.probeTimeout != null || session.closed || session.destroyed) {
530
- return
531
- }
532
-
533
- try {
534
- session.ping(onHttp2ProbeAck.bind(session))
535
- } catch {
536
- // The session is going away on its own.
537
- return
538
- }
539
-
540
- state.probeTimeout = setTimeout(onHttp2ProbeTimeout, Math.max(timeout, MIN_PROBE_TIMEOUT), session).unref()
541
- }
542
-
543
- function clearHttp2ProbeTimeout (session) {
544
- const state = session[kHTTP2SessionState]
545
-
546
- if (state?.probeTimeout != null) {
547
- clearTimeout(state.probeTimeout)
548
- state.probeTimeout = null
549
- }
550
- }
551
-
552
- function onHttp2ProbeAck () {
553
- if (this[kHTTP2SessionState].probeTimeout == null) {
554
- return
555
- }
556
-
557
- clearHttp2ProbeTimeout(this)
558
- this[kClient][kResume]()
559
- }
560
-
561
- function onHttp2ProbeTimeout (session) {
562
- session[kHTTP2SessionState].probeTimeout = null
563
-
564
- if (session.closed || session.destroyed) {
565
- return
566
- }
567
-
568
- const err = new SocketError('HTTP/2: connection unresponsive', util.getSocketInfo(session[kSocket]))
569
- session[kError] = err
570
- resetHttp2Session(session, err)
571
- }
572
-
573
- function clearHttp2IdleTimeout (session) {
574
- const state = session[kHTTP2SessionState]
575
-
576
- if (state?.idleTimeout != null) {
577
- clearTimeout(state.idleTimeout)
578
- state.idleTimeout = null
579
- }
580
- }
581
-
582
- function setHttp2IdleTimeout (session) {
583
- const client = session[kClient]
584
-
585
- if (client[kHTTP2Session] !== session || session.closed || session.destroyed) {
586
- return
587
- }
588
-
589
- if (session[kOpenStreams] !== 0 || client[kSize] !== 0) {
590
- clearHttp2IdleTimeout(session)
591
- return
592
- }
593
-
594
- const state = session[kHTTP2SessionState]
595
- if (state.idleTimeout == null) {
596
- state.idleTimeout = setTimeout(onHttp2SessionIdleTimeout, client[kKeepAliveDefaultTimeout], session).unref()
597
- }
598
- }
599
-
600
- function onHttp2SessionIdleTimeout (session) {
601
- const client = session[kClient]
602
- const socket = session[kSocket]
603
- const state = session[kHTTP2SessionState]
604
-
605
- state.idleTimeout = null
606
-
607
- if (client[kHTTP2Session] !== session || session[kOpenStreams] !== 0 || client[kSize] !== 0 || session.closed || session.destroyed) {
608
- return
609
236
  }
610
-
611
- const err = new InformationalError('socket idle timeout')
612
- socket[kError] = err
613
- util.destroy(socket, err)
614
237
  }
615
238
 
616
239
  function applyConnectionWindowSize (connectionWindowSize) {
@@ -624,14 +247,8 @@ function applyConnectionWindowSize (connectionWindowSize) {
624
247
  }
625
248
 
626
249
  function onHttp2RemoteSettings (settings) {
627
- const client = this[kClient]
628
-
629
- // The configured maxConcurrentStreams (default 100) is the client's own
630
- // ceiling. The server's SETTINGS_MAX_CONCURRENT_STREAMS can lower it, but
631
- // must not raise it: a default Node.js server advertises 2^32-1.
632
- const localMaxConcurrentStreams = client[kHTTP2Options].maxConcurrentStreams
633
- const remoteMaxConcurrentStreams = settings.maxConcurrentStreams ?? client[kMaxConcurrentStreams] ?? localMaxConcurrentStreams
634
- client[kMaxConcurrentStreams] = Math.min(remoteMaxConcurrentStreams, localMaxConcurrentStreams)
250
+ // Fallbacks are a safe bet, remote setting will always override
251
+ this[kClient][kMaxConcurrentStreams] = settings.maxConcurrentStreams ?? this[kClient][kMaxConcurrentStreams]
635
252
  /**
636
253
  * From RFC-8441
637
254
  * A sender MUST NOT send a SETTINGS_ENABLE_CONNECT_PROTOCOL parameter
@@ -663,7 +280,7 @@ function onHttp2SendPing (session) {
663
280
 
664
281
  function onPing (err, duration) {
665
282
  const client = this[kClient]
666
- const socket = this[kSocket]
283
+ const socket = this[kClient]
667
284
 
668
285
  if (err != null) {
669
286
  const error = new InformationalError(`HTTP/2: "PING" errored - type ${err.message}`)
@@ -677,26 +294,23 @@ function onHttp2SendPing (session) {
677
294
 
678
295
  function onHttp2SessionError (err) {
679
296
  this[kSocket][kError] = err
680
-
681
- if (this[kReceivedGoAway]) {
682
- return
683
- }
684
-
685
297
  this[kClient][kOnError](err)
686
298
  }
687
299
 
688
300
  function onHttp2FrameError (type, code, id) {
689
301
  if (id === 0) {
690
- if (this[kReceivedGoAway]) {
691
- return
692
- }
693
-
694
302
  const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`)
695
303
  this[kSocket][kError] = err
696
304
  this[kClient][kOnError](err)
697
305
  }
698
306
  }
699
307
 
308
+ function onHttp2SessionEnd () {
309
+ const err = new SocketError('other side closed', util.getSocketInfo(this[kSocket]))
310
+ this.destroy(err)
311
+ util.destroy(this[kSocket], err)
312
+ }
313
+
700
314
  /**
701
315
  * This is the root cause of #3011
702
316
  * We need to handle GOAWAY frames properly, and trigger the session close
@@ -704,95 +318,80 @@ function onHttp2FrameError (type, code, id) {
704
318
  *
705
319
  * @this {import('http2').ClientHttp2Session}
706
320
  * @param {number} errorCode
707
- * @param {number} lastStreamID
708
321
  */
709
- function onHttp2SessionGoAway (errorCode, lastStreamID) {
710
- if (this[kReceivedGoAway]) {
322
+ // Backport of #5410 and #5569. HTTP/2 multiplexes, so requests complete out of
323
+ // order; advancing kRunningIdx blindly retired whichever request happened to
324
+ // sit at the head instead of the one that actually finished, which both lost
325
+ // requests and left phantom running slots behind.
326
+ function completeRequest (client, request, resetPendingIdx = false) {
327
+ const queue = client[kQueue]
328
+ const runningIdx = client[kRunningIdx]
329
+
330
+ // In-order completion: clear the request and advance without splicing.
331
+ // The client's resume loop compacts cleared slots once the index grows.
332
+ if (runningIdx < client[kPendingIdx] && queue[runningIdx] === request) {
333
+ queue[runningIdx] = null
334
+ client[kRunningIdx] = runningIdx + 1
711
335
  return
712
336
  }
713
337
 
714
- this[kReceivedGoAway] = true
715
-
716
- const err = getGoAwayError(this, errorCode)
717
- const client = this[kClient]
718
- const previousPendingIdx = client[kPendingIdx]
719
- const pendingIdx = getGoAwayPendingIdx(client, lastStreamID)
720
- const retriableRequests = []
721
- const streamsToClose = []
722
-
723
- // Closing one stream after GOAWAY can synchronously emit frameError on
724
- // sibling streams. Detach all affected requests first so those errors do
725
- // not fail requests that are about to be requeued.
726
- for (let i = pendingIdx; i < previousPendingIdx; i++) {
727
- const request = client[kQueue][i]
338
+ const index = queue.indexOf(request, runningIdx)
728
339
 
729
- if (request != null) {
730
- // Read before detaching, which drops the stream state.
731
- const responseStarted = hasResponseStarted(request)
340
+ if (index === -1 || index >= client[kPendingIdx]) {
341
+ return
342
+ }
732
343
 
733
- streamsToClose.push(detachRequestStreamForClose(request))
344
+ queue.splice(index, 1)
345
+ client[kPendingIdx]--
734
346
 
735
- if (!responseStarted && canReplayRequest(request) && registerGoAwayRefusal(request)) {
736
- retriableRequests.push(request)
737
- } else {
738
- util.errorRequest(client, request, err)
739
- }
740
- }
347
+ if (resetPendingIdx && client[kPendingIdx] < client[kRunningIdx]) {
348
+ client[kPendingIdx] = client[kRunningIdx]
741
349
  }
350
+ }
742
351
 
743
- if (pendingIdx !== previousPendingIdx) {
744
- const remainingPendingRequests = client[kQueue].slice(previousPendingIdx)
745
- client[kQueue].length = pendingIdx
746
- client[kQueue].push(...retriableRequests, ...remainingPendingRequests)
747
- }
352
+ function onHttp2SessionGoAway (errorCode) {
353
+ // TODO(mcollina): Verify if GOAWAY implements the spec correctly:
354
+ // https://datatracker.ietf.org/doc/html/rfc7540#section-6.8
355
+ // Specifically, we do not verify the "valid" stream id.
748
356
 
749
- // Publish the rebuilt queue and detach the session before closing anything.
750
- // A synchronous sibling HEADERS frameError can requeue an accepted-but-unsent
751
- // request and resume the client. It must see the final indices and must not
752
- // dispatch its retry on the session that is being retired.
753
- client[kPendingIdx] = pendingIdx
357
+ const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${errorCode}`, util.getSocketInfo(this[kSocket]))
358
+ const client = this[kClient]
754
359
 
755
- if (client[kHTTP2Session] === this) {
756
- client[kSocket] = null
757
- client[kHTTPContext] = null
758
- client[kHTTP2Session] = null
759
- }
360
+ client[kSocket] = null
361
+ client[kHTTPContext] = null
760
362
 
761
- if (this[kOpenStreams] === 0) {
762
- unrefH2Session(this)
763
- }
363
+ // this is an HTTP2 session
364
+ this.close()
365
+ this[kHTTP2Session] = null
764
366
 
765
- clearHttp2IdleTimeout(this)
766
- clearNoStreamsTimeout(this)
767
- clearHttp2ProbeTimeout(this)
367
+ util.destroy(this[kSocket], err)
768
368
 
769
- for (let i = 0; i < streamsToClose.length; i++) {
770
- closeStream(streamsToClose[i])
369
+ // Fail head of pipeline.
370
+ if (client[kRunningIdx] < client[kQueue].length) {
371
+ const request = client[kQueue][client[kRunningIdx]]
372
+ client[kQueue][client[kRunningIdx]++] = null
373
+ if (request != null) {
374
+ util.errorRequest(client, request, err)
375
+ }
376
+ client[kPendingIdx] = client[kRunningIdx]
771
377
  }
772
378
 
773
- if (!this.closed && !this.destroyed) {
774
- this.close()
775
- }
379
+ assert(client[kRunning] === 0)
776
380
 
777
381
  client.emit('disconnect', client[kUrl], [client], err)
382
+ client.emit('connectionError', client[kUrl], [client], err)
778
383
 
779
384
  client[kResume]()
780
385
  }
781
386
 
782
387
  function onHttp2SessionClose () {
783
- const { [kClient]: client, [kHTTP2SessionState]: state, [kSocket]: socket } = this
388
+ const { [kClient]: client, [kHTTP2SessionState]: state } = this
389
+ const { [kSocket]: socket } = client
784
390
 
785
- const err = socket[kError] || this[kError] || new SocketError('closed', util.getSocketInfo(socket))
391
+ const err = this[kSocket][kError] || this[kError] || new SocketError('closed', util.getSocketInfo(socket))
786
392
 
787
- if (client[kHTTP2Session] === this) {
788
- client[kSocket] = null
789
- client[kHTTPContext] = null
790
- client[kHTTP2Session] = null
791
- }
792
-
793
- clearHttp2IdleTimeout(this)
794
- clearNoStreamsTimeout(this)
795
- clearHttp2ProbeTimeout(this)
393
+ client[kSocket] = null
394
+ client[kHTTPContext] = null
796
395
 
797
396
  if (state.ping.interval != null) {
798
397
  clearInterval(state.ping.interval)
@@ -816,26 +415,14 @@ function onHttp2SessionClose () {
816
415
  function onHttp2SocketClose () {
817
416
  const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
818
417
 
819
- const session = this[kHTTP2Session]
820
- const client = session[kClient]
821
-
822
- if (client[kSocket] !== this) {
823
- // Ignore stale socket closes from a detached GOAWAY session and from any
824
- // session that has already been replaced. If the session was detached
825
- // without a GOAWAY and there is no replacement yet, we still need the
826
- // close event to flush the client state.
827
- if (session[kReceivedGoAway] || (client[kHTTP2Session] != null && client[kHTTP2Session] !== session)) {
828
- return
829
- }
830
- }
418
+ const client = this[kHTTP2Session][kClient]
831
419
 
832
420
  client[kSocket] = null
833
421
  client[kHTTPContext] = null
834
- if (client[kHTTP2Session] === session) {
835
- client[kHTTP2Session] = null
836
- }
837
422
 
838
- session.destroy(err)
423
+ if (this[kHTTP2Session] !== null) {
424
+ this[kHTTP2Session].destroy(err)
425
+ }
839
426
 
840
427
  client[kPendingIdx] = client[kRunningIdx]
841
428
 
@@ -849,11 +436,7 @@ function onHttp2SocketClose () {
849
436
  function onHttp2SocketError (err) {
850
437
  this[kError] = err
851
438
 
852
- if (this[kHTTP2Session]?.[kReceivedGoAway]) {
853
- return
854
- }
855
-
856
- this[kHTTP2Session]?.[kClient]?.[kOnError](err)
439
+ this[kClient][kOnError](err)
857
440
  }
858
441
 
859
442
  function onHttp2SocketEnd () {
@@ -864,295 +447,64 @@ function onSocketClose () {
864
447
  this[kClosed] = true
865
448
  }
866
449
 
867
- function noop () {}
450
+ // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
451
+ function shouldSendContentLength (method) {
452
+ return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
453
+ }
868
454
 
869
- function closeStreamSession (stream) {
870
- const session = stream[kHTTP2Session]
871
- const client = session[kClient]
455
+ function writeH2 (client, request) {
456
+ // Time to the response headers, then time between body chunks. Using
457
+ // bodyTimeout for both made headersTimeout a no-op over HTTP/2.
458
+ const headersTimeout = request.headersTimeout ?? client[kHeadersTimeout]
459
+ const bodyTimeout = request.bodyTimeout ?? client[kBodyTimeout]
460
+ const session = client[kHTTP2Session]
461
+ const { method, path, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request
462
+ let { body } = request
872
463
 
873
- stream[kHTTP2Session] = null
874
- session[kOpenStreams] -= 1
875
- // A session that received GOAWAY does not need to stay ref'd for queued requests.
876
- if (session[kOpenStreams] === 0 && (client[kSize] === 0 || session[kReceivedGoAway])) {
877
- unrefH2Session(session)
878
- setHttp2IdleTimeout(session)
464
+ if (upgrade != null && upgrade !== 'websocket') {
465
+ util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`))
466
+ return false
879
467
  }
880
- }
881
-
882
- function onUpgradeStreamClose () {
883
- // #5936: Retain the noop error sink so a session-level error delivered to
884
- // this stream after undici detaches it cannot crash via an unhandled 'error'.
885
- const state = this[kRequestStreamState]
886
- this[kRequestStreamState] = null
887
468
 
888
- failUpgradeStream(state, new InformationalError('HTTP/2: stream closed before response headers'))
889
- closeStreamSession(this)
890
- }
891
-
892
- // Idempotent terminal cleanup, called from both 'end' and 'close': the
893
- // null-state guard no-ops the later call.
894
- function completeRequestStream () {
895
- const state = this[kRequestStreamState]
896
-
897
- if (state == null) {
898
- return
899
- }
900
-
901
- // Release the stream first so request references are cleared,
902
- // then complete the response with trailers if available.
903
- releaseRequestStream(this)
904
-
905
- if (state.pendingEnd && !state.request.aborted && !state.request.completed) {
906
- state.request.onResponseEnd(state.trailers || {})
907
- } else if (!state.request.aborted && !state.request.completed) {
908
- // The stream closed without a complete response and without reporting an
909
- // error. finalizeRequest() below frees the queue slot either way, so
910
- // without this the request would simply vanish and its caller would never
911
- // hear back.
912
- util.errorRequest(
913
- state.client,
914
- state.request,
915
- new InformationalError('HTTP/2: stream closed before the response was complete')
916
- )
917
- }
918
-
919
- finalizeRequest(state)
920
- closeStreamSession(this)
921
- this[kRequestStreamState] = null
922
- }
923
-
924
- // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
925
- function shouldSendContentLength (method) {
926
- return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
927
- }
928
-
929
- function buildRequestHeaders (reqHeaders) {
930
469
  const headers = {}
931
-
932
470
  for (let n = 0; n < reqHeaders.length; n += 2) {
933
471
  const key = reqHeaders[n + 0]
934
472
  const val = reqHeaders[n + 1]
935
- // Reading headers[key] directly resolves `__proto__` through the prototype
936
- // chain instead of reporting the header as absent.
937
- const current = Object.hasOwn(headers, key) ? headers[key] : undefined
938
473
 
939
474
  if (key === 'cookie') {
940
- if (current != null) {
941
- util.setHeader(headers, key, Array.isArray(current) ? (current.push(val), current) : [current, val])
475
+ if (headers[key] != null) {
476
+ headers[key] = Array.isArray(headers[key]) ? (headers[key].push(val), headers[key]) : [headers[key], val]
942
477
  } else {
943
- util.setHeader(headers, key, val)
478
+ headers[key] = val
944
479
  }
945
480
 
946
481
  continue
947
482
  }
948
483
 
949
- if (typeof val === 'string') {
950
- util.setHeader(headers, key, current ? `${current}, ${val}` : val)
951
- continue
952
- }
953
-
954
- for (let i = 0; i < val.length; i++) {
955
- util.setHeader(headers, key, Object.hasOwn(headers, key) ? `${headers[key]}, ${val[i]}` : val[i])
956
- }
957
- }
958
-
959
- return headers
960
- }
961
-
962
- function removeUpgradeStreamListeners (stream) {
963
- stream.off('response', onUpgradeResponse)
964
- stream.off('error', onUpgradeStreamError)
965
- stream.off('end', onUpgradeStreamEnd)
966
- stream.off('timeout', onUpgradeStreamTimeout)
967
- stream.off('error', noop)
968
- }
969
-
970
- function releaseUpgradeStream (stream) {
971
- if (stream == null) {
972
- return
973
- }
974
-
975
- const state = stream[kRequestStreamState]
976
- if (state == null) {
977
- return
978
- }
979
-
980
- const { request } = state
981
-
982
- if (request[kRequestStream] === stream) {
983
- detachRequestFromStream(request)
984
- }
985
-
986
- removeUpgradeStreamListeners(stream)
987
-
988
- // #5936: removeUpgradeStreamListeners() dropped the noop sink; re-attach a
989
- // persistent one so a late session-level error on this (possibly still native
990
- // tracked) stream cannot crash via an unhandled 'error'.
991
- if (!stream.destroyed && !stream.closed) {
992
- stream.on('error', noop)
993
- }
994
- }
995
-
996
- function failUpgradeStream (state, err) {
997
- if (state == null) {
998
- return
999
- }
1000
-
1001
- const { request } = state
1002
- if (state.responseReceived || request.aborted || request.completed) {
1003
- return
1004
- }
1005
-
1006
- releaseUpgradeStream(state.stream)
1007
- state.abort(err, true)
1008
- }
1009
-
1010
- function onUpgradeStreamError () {
1011
- const state = this[kRequestStreamState]
1012
-
1013
- if (typeof this.rstCode === 'number' && this.rstCode !== 0) {
1014
- failUpgradeStream(state, new InformationalError(`HTTP/2: "stream error" received - code ${this.rstCode}`))
1015
- } else {
1016
- failUpgradeStream(state, new InformationalError('HTTP/2: stream errored before response headers'))
1017
- }
1018
- }
1019
-
1020
- function onUpgradeStreamEnd () {
1021
- failUpgradeStream(this[kRequestStreamState], new InformationalError('HTTP/2: stream half-closed (remote)'))
1022
- }
1023
-
1024
- function onUpgradeStreamTimeout () {
1025
- const state = this[kRequestStreamState]
1026
- failUpgradeStream(state, new InformationalError(`HTTP/2: "stream timeout after ${state.headersTimeout}"`))
1027
- }
1028
-
1029
- function onUpgradeResponse (headers, _flags) {
1030
- const stream = this
1031
- const state = stream[kRequestStreamState]
1032
- const { request } = state
1033
-
1034
- state.responseReceived = true
1035
-
1036
- const statusCode = headers[HTTP2_HEADER_STATUS]
1037
- delete headers[HTTP2_HEADER_STATUS]
1038
-
1039
- try {
1040
- request.onRequestUpgrade(statusCode, headers, stream)
1041
- } catch (err) {
1042
- state.abort(err)
1043
- return
1044
- }
1045
-
1046
- if (request.aborted) {
1047
- return
1048
- }
1049
-
1050
- removeUpgradeStreamListeners(stream)
1051
- detachRequestFromStream(request)
1052
- finalizeRequest(state)
1053
- }
1054
-
1055
- function setupUpgradeStream (stream, state) {
1056
- const { request, headersTimeout, session } = state
1057
-
1058
- stream[kHTTP2Stream] = true
1059
- stream[kHTTP2Session] = session
1060
- stream[kRequestStreamState] = state
1061
- state.stream = stream
1062
-
1063
- bindRequestToStream(request, stream, releaseUpgradeStream)
1064
- stream.once('response', onUpgradeResponse)
1065
- stream.on('error', onUpgradeStreamError)
1066
- stream.once('end', onUpgradeStreamEnd)
1067
- stream.on('timeout', onUpgradeStreamTimeout)
1068
- stream.once('close', onUpgradeStreamClose)
1069
-
1070
- clearHttp2IdleTimeout(session)
1071
- ++session[kOpenStreams]
1072
- stream.setTimeout(headersTimeout)
1073
- }
1074
-
1075
- function finalizeRequest (state, resetPendingIdx = false) {
1076
- if (state.requestFinalized) {
1077
- return
1078
- }
1079
-
1080
- state.requestFinalized = true
1081
- completeRequest(state.client, state.request, resetPendingIdx)
1082
-
1083
- state.client[kResume]()
1084
- }
1085
-
1086
- function openStream (client, request, session, abort, headers, options) {
1087
- try {
1088
- return session.request(headers, options)
1089
- } catch (err) {
1090
- // A GOAWAY'd session rejects new streams, same as an invalid session:
1091
- // reset and requeue on a fresh connection rather than the destroy + abort
1092
- // below, whose destroy(socket, err) can crash via an unhandled 'error'.
1093
- if (err?.code === 'ERR_HTTP2_INVALID_SESSION' || err?.code === 'ERR_HTTP2_GOAWAY_SESSION') {
1094
- const wrappedErr = new SocketError(err.message, util.getSocketInfo(session[kSocket]))
1095
- wrappedErr.cause = err
1096
- session[kError] = wrappedErr
1097
- resetHttp2Session(session, wrappedErr)
1098
- requeueUnsentRequest(client, request)
1099
-
1100
- return null
484
+ if (Array.isArray(val)) {
485
+ for (let i = 0; i < val.length; i++) {
486
+ if (headers[key]) {
487
+ headers[key] += `, ${val[i]}`
488
+ } else {
489
+ headers[key] = val[i]
490
+ }
491
+ }
492
+ } else if (headers[key]) {
493
+ headers[key] += `, ${val}`
494
+ } else {
495
+ headers[key] = val
1101
496
  }
1102
-
1103
- const wrappedErr = new InformationalError(err.message, { cause: err })
1104
- session[kError] = wrappedErr
1105
- session[kSocket][kError] = wrappedErr
1106
-
1107
- session.destroy(wrappedErr)
1108
- util.destroy(session[kSocket], wrappedErr)
1109
- abort(wrappedErr)
1110
-
1111
- return null
1112
497
  }
1113
- }
1114
498
 
1115
- function writeH2 (client, request) {
1116
- const headersTimeout = request.headersTimeout ?? client[kHeadersTimeout]
1117
- const bodyTimeout = request.bodyTimeout ?? client[kBodyTimeout]
1118
- const session = client[kHTTP2Session]
1119
- const { method, path, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request
1120
-
1121
- if (upgrade != null && upgrade !== 'websocket') {
1122
- util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`))
1123
- return false
1124
- }
499
+ /** @type {import('node:http2').ClientHttp2Stream} */
500
+ let stream = null
1125
501
 
1126
- const headers = buildRequestHeaders(reqHeaders)
502
+ const { hostname, port } = client[kUrl]
1127
503
 
1128
- headers[HTTP2_HEADER_AUTHORITY] = host || client[kHostAuthority]
504
+ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ''}`
1129
505
  headers[HTTP2_HEADER_METHOD] = method
1130
506
 
1131
- // Single pre-shaped state object shared by all stream event handlers.
1132
- // All fields are declared up-front so the object keeps a stable hidden
1133
- // class for the whole request lifetime.
1134
- const state = {
1135
- abort: null,
1136
- body: request.body,
1137
- bytesRead: 0,
1138
- client,
1139
- contentLength: null,
1140
- expectsPayload: false,
1141
- maxResponseSize: client[kMaxResponseSize],
1142
- request,
1143
- headersTimeout,
1144
- bodyTimeout,
1145
- requestFinalized: false,
1146
- responseContentLength: null,
1147
- responseReceived: false,
1148
- bodySent: false,
1149
- pendingEnd: false,
1150
- trailers: null,
1151
- session,
1152
- stream: null
1153
- }
1154
-
1155
- const abort = (err, resetPendingIdx = false) => {
507
+ const abort = (err) => {
1156
508
  if (request.aborted || request.completed) {
1157
509
  return
1158
510
  }
@@ -1161,44 +513,29 @@ function writeH2 (client, request) {
1161
513
 
1162
514
  util.errorRequest(client, request, err)
1163
515
 
1164
- if (state.stream != null) {
1165
- clearRequestStream(request)
516
+ if (stream != null) {
517
+ // Some chunks might still come after abort,
518
+ // let's ignore them
519
+ stream.removeAllListeners('data')
1166
520
 
1167
- // On Abort, we close the stream to send RST_STREAM frame.
1168
- const stream = state.stream
521
+ // On Abort, we close the stream to send RST_STREAM frame
1169
522
  stream.close()
1170
523
 
1171
- // close() alone leaves cleanup waiting on the 'close' event; on a busy,
1172
- // long-lived multiplexed session that event can fail to fire, leaving the
1173
- // native Http2Stream (and the whole request graph it pins) alive for the
1174
- // session's life. Destroy the stream synchronously to release the handle
1175
- // deterministically. Deferring the destroy (e.g. via setImmediate) leaks
1176
- // the same way when the event loop is stalled and the callback never runs
1177
- // under abort churn (#5558); close() has already queued the RST_STREAM
1178
- // frame on the native session, so a synchronous destroy still sends it.
1179
- if (!stream.destroyed) {
1180
- util.destroy(stream)
1181
- }
1182
-
1183
524
  // We move the running index to the next request
1184
525
  client[kOnError](err)
1185
- finalizeRequest(state, resetPendingIdx)
526
+ completeRequest(client, request)
527
+ client[kResume]()
1186
528
  }
1187
529
 
1188
530
  // We do not destroy the socket as we can continue using the session
1189
531
  // the stream gets destroyed and the session remains to create new streams
1190
- util.destroy(state.body, err)
532
+ util.destroy(body, err)
1191
533
  }
1192
534
 
1193
- state.abort = abort
1194
-
1195
- /** @type {import('node:http2').ClientHttp2Stream} */
1196
- let stream = null
1197
-
1198
535
  try {
1199
536
  // We are already connected, streams are pending.
1200
537
  // We can call on connect, and wait for abort
1201
- request.onRequestStart(abort, null)
538
+ request.onConnect(abort)
1202
539
  } catch (err) {
1203
540
  util.errorRequest(client, request, err)
1204
541
  }
@@ -1208,13 +545,13 @@ function writeH2 (client, request) {
1208
545
  }
1209
546
 
1210
547
  if (upgrade || method === 'CONNECT') {
1211
- refH2Session(session)
548
+ session.ref()
1212
549
 
1213
550
  if (upgrade === 'websocket') {
1214
551
  // We cannot upgrade to websocket if extended CONNECT protocol is not supported
1215
552
  if (session[kEnableConnectProtocol] === false) {
1216
553
  util.errorRequest(client, request, new InformationalError('HTTP/2: Extended CONNECT protocol not supported by server'))
1217
- unrefH2Session(session)
554
+ session.unref()
1218
555
  return false
1219
556
  }
1220
557
 
@@ -1232,12 +569,37 @@ function writeH2 (client, request) {
1232
569
  headers[HTTP2_HEADER_SCHEME] = protocol === 'http:' ? 'http' : 'https'
1233
570
  }
1234
571
 
1235
- stream = openStream(client, request, session, abort, headers, { endStream: false, signal })
1236
- if (stream == null) {
1237
- unrefH2Session(session)
1238
- return false
1239
- }
1240
- setupUpgradeStream(stream, state)
572
+ stream = session.request(headers, { endStream: false, signal })
573
+ stream[kHTTP2Stream] = true
574
+ ++session[kOpenStreams]
575
+
576
+ stream.once('response', (headers, _flags) => {
577
+ const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
578
+
579
+ try {
580
+ request.onUpgrade(statusCode, parseH2Headers(realHeaders), stream)
581
+ } catch (err) {
582
+ abort(err)
583
+ return
584
+ }
585
+ completeRequest(client, request)
586
+ })
587
+
588
+ stream.on('error', () => {
589
+ if (stream.rstCode === NGHTTP2_REFUSED_STREAM || stream.rstCode === NGHTTP2_CANCEL) {
590
+ // NGHTTP2_REFUSED_STREAM (7) or NGHTTP2_CANCEL (8)
591
+ // We do not treat those as errors as the server might
592
+ // not support websockets and refuse the stream
593
+ abort(new InformationalError(`HTTP/2: "stream error" received - code ${stream.rstCode}`))
594
+ }
595
+ })
596
+
597
+ stream.once('close', () => {
598
+ session[kOpenStreams] -= 1
599
+ if (session[kOpenStreams] === 0) session.unref()
600
+ })
601
+
602
+ stream.setTimeout(headersTimeout)
1241
603
  return true
1242
604
  }
1243
605
 
@@ -1246,12 +608,26 @@ function writeH2 (client, request) {
1246
608
  // will create a new stream. We trigger a request to create the stream and wait until
1247
609
  // `ready` event is triggered
1248
610
  // We disabled endStream to allow the user to write to the stream
1249
- stream = openStream(client, request, session, abort, headers, { endStream: false, signal })
1250
- if (stream == null) {
1251
- unrefH2Session(session)
1252
- return false
1253
- }
1254
- setupUpgradeStream(stream, state)
611
+ stream = session.request(headers, { endStream: false, signal })
612
+ stream[kHTTP2Stream] = true
613
+ ++session[kOpenStreams]
614
+ stream.on('response', headers => {
615
+ const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
616
+
617
+ try {
618
+ request.onUpgrade(statusCode, parseH2Headers(realHeaders), stream)
619
+ } catch (err) {
620
+ abort(err)
621
+ return
622
+ }
623
+ completeRequest(client, request)
624
+ })
625
+ stream.on('error', abort)
626
+ stream.once('close', () => {
627
+ session[kOpenStreams] -= 1
628
+ if (session[kOpenStreams] === 0) session.unref()
629
+ })
630
+ stream.setTimeout(headersTimeout)
1255
631
 
1256
632
  return true
1257
633
  }
@@ -1273,14 +649,9 @@ function writeH2 (client, request) {
1273
649
  const expectsPayload = (
1274
650
  method === 'PUT' ||
1275
651
  method === 'POST' ||
1276
- method === 'PATCH' ||
1277
- method === 'QUERY' ||
1278
- method === 'PROPFIND' ||
1279
- method === 'PROPPATCH'
652
+ method === 'PATCH'
1280
653
  )
1281
654
 
1282
- let body = state.body
1283
-
1284
655
  if (body && typeof body.read === 'function') {
1285
656
  // Try to read EOF in order to get length.
1286
657
  body.read(0)
@@ -1302,7 +673,7 @@ function writeH2 (client, request) {
1302
673
  contentLength = request.contentLength
1303
674
  }
1304
675
 
1305
- if (contentLength === 0 && !expectsPayload) {
676
+ if (!expectsPayload) {
1306
677
  // https://tools.ietf.org/html/rfc7230#section-3.3.2
1307
678
  // A user agent SHOULD NOT send a Content-Length header field when
1308
679
  // the request message does not contain a payload body and the method
@@ -1327,7 +698,7 @@ function writeH2 (client, request) {
1327
698
  headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`
1328
699
  }
1329
700
 
1330
- refH2Session(session)
701
+ session.ref()
1331
702
 
1332
703
  if (channels.sendHeaders.hasSubscribers) {
1333
704
  let header = ''
@@ -1338,479 +709,149 @@ function writeH2 (client, request) {
1338
709
  }
1339
710
 
1340
711
  // TODO(metcoder95): add support for sending trailers
1341
- const shouldEndStream = body === null || contentLength === 0
1342
-
1343
- state.body = body
1344
- state.contentLength = contentLength
1345
- state.expectsPayload = expectsPayload
1346
-
712
+ const shouldEndStream = method === 'GET' || method === 'HEAD' || body === null
1347
713
  if (expectContinue) {
1348
714
  headers[HTTP2_HEADER_EXPECT] = '100-continue'
1349
- }
715
+ stream = session.request(headers, { endStream: shouldEndStream, signal })
716
+ stream[kHTTP2Stream] = true
1350
717
 
1351
- stream = openStream(client, request, session, abort, headers, { endStream: shouldEndStream, signal })
1352
- if (stream == null) {
1353
- return false
1354
- }
1355
- stream[kHTTP2Stream] = true
1356
- stream[kRequestStreamState] = state
1357
- state.stream = stream
1358
-
1359
- // Increment counter as we have new streams open
1360
- clearHttp2IdleTimeout(session)
1361
- ++session[kOpenStreams]
1362
-
1363
- if (headersTimeout) {
1364
- stream.setTimeout(headersTimeout)
1365
- }
1366
-
1367
- stream[kHTTP2Session] = session
1368
- stream.on('close', completeRequestStream)
1369
-
1370
- bindRequestToStream(request, stream, releaseRequestStream)
1371
- if (expectContinue) {
1372
718
  stream.once('continue', writeBodyH2)
1373
- }
1374
- // The handlers below either remove themselves on first invocation or
1375
- // become unreachable once the stream closes, so plain `on` avoids the
1376
- // per-listener `once` wrapper allocation.
1377
- stream.on('response', onResponse)
1378
- stream.on('headers', onInterimResponse)
1379
- stream.on('end', onEnd)
1380
- stream.on('error', onError)
1381
- stream.on('frameError', onFrameError)
1382
- stream.on('aborted', onAborted)
1383
- if (headersTimeout || bodyTimeout) {
1384
- stream.on('timeout', onTimeout)
1385
- }
1386
- stream.on('trailers', onTrailers)
1387
-
1388
- if (!expectContinue) {
1389
- writeBodyH2.call(stream)
1390
- }
1391
-
1392
- return true
1393
- }
1394
-
1395
- function removeRequestStreamListeners (stream) {
1396
- stream.off('error', noop)
1397
- stream.off('continue', writeBodyH2)
1398
- stream.off('response', onResponse)
1399
- stream.off('headers', onInterimResponse)
1400
- stream.off('end', onEnd)
1401
- stream.off('error', onError)
1402
- stream.off('frameError', onFrameError)
1403
- stream.off('aborted', onAborted)
1404
- stream.off('timeout', onTimeout)
1405
- stream.off('trailers', onTrailers)
1406
- stream.off('data', onData)
1407
- }
1408
-
1409
- function releaseRequestStream (stream) {
1410
- if (stream == null) {
1411
- return
1412
- }
1413
-
1414
- const state = stream[kRequestStreamState]
1415
- if (state == null) {
1416
- return
1417
- }
1418
-
1419
- const { request } = state
1420
-
1421
- if (request[kRequestStream] === stream) {
1422
- detachRequestFromStream(request)
1423
- }
1424
-
1425
- // #5936: Node can deliver a session-level error to a released stream before
1426
- // its native handle is dropped (e.g. on idle session teardown). Attach a
1427
- // persistent noop error sink so a late 'error' always has a listener and
1428
- // cannot crash the process. A closed/destroyed stream cannot emit further
1429
- // events and is no longer tracked natively, so skip the listener teardown.
1430
- if (!stream.destroyed && !stream.closed) {
1431
- removeRequestStreamListeners(stream)
1432
- stream.on('error', noop)
1433
- }
1434
- }
1435
-
1436
- function onData (chunk) {
1437
- const stream = this
1438
- const state = stream[kRequestStreamState]
1439
-
1440
- if (state == null) {
1441
- return
1442
- }
1443
-
1444
- const { request, maxResponseSize, responseContentLength } = state
1445
-
1446
- if (request.aborted || request.completed) {
1447
- return
1448
- }
1449
-
1450
- if (responseContentLength != null && state.bytesRead + chunk.length > responseContentLength) {
1451
- state.abort(new ResponseContentLengthMismatchError())
1452
- return
1453
- }
1454
-
1455
- if (maxResponseSize > -1 && state.bytesRead + chunk.length > maxResponseSize) {
1456
- // Unlike HTTP/1.1, which destroys the socket because it cannot abandon one
1457
- // response without losing framing, resetting the offending stream leaves
1458
- // the session usable for its siblings.
1459
- state.abort(new ResponseExceededMaxSizeError())
1460
- return
1461
- }
1462
-
1463
- state.bytesRead += chunk.length
1464
-
1465
- if (request.onResponseData(chunk) === false) {
1466
- pauseResponseStream(stream, state)
1467
- }
1468
- }
1469
-
1470
- // The body timeout measures how long the peer takes to send data. While the
1471
- // consumer applies backpressure the peer can't send (it's out of flow-control
1472
- // window), and Http2Stream's timer, which counts stream activity, would fire.
1473
- // Stop it while paused and start a fresh one on resume, like HTTP/1.1, which
1474
- // ignores the body timeout while its parser is paused.
1475
- function pauseResponseStream (stream, state) {
1476
- stream.pause()
1477
- if (state.bodyTimeout) {
1478
- stream.setTimeout(0)
1479
- }
1480
- }
1481
-
1482
- // Passed to the handler as its resume callback, bound to the stream.
1483
- function resumeResponseStream () {
1484
- const stream = this
1485
- const state = stream[kRequestStreamState]
1486
-
1487
- if (state != null && state.bodyTimeout && stream.isPaused()) {
1488
- stream.setTimeout(state.bodyTimeout)
1489
- }
1490
-
1491
- stream.resume()
1492
- }
1493
-
1494
- function onInterimResponse (headers) {
1495
- const stream = this
1496
- const state = stream[kRequestStreamState]
1497
-
1498
- if (state == null) {
1499
- return
1500
- }
1501
-
1502
- const { request } = state
1503
-
1504
- if (request.aborted || request.completed) {
1505
- return
1506
- }
1507
-
1508
- // node http2 emits 'headers' for interim (1xx) informational responses,
1509
- // while the final response arrives via 'response'. Forward these to the
1510
- // handler so that onInfo is invoked, matching the HTTP/1 behaviour and the
1511
- // documented onInfo contract.
1512
- const statusCode = headers[HTTP2_HEADER_STATUS]
1513
- delete headers[HTTP2_HEADER_STATUS]
1514
-
1515
- request.onResponseStart(Number(statusCode), headers, noop, '')
1516
- }
1517
-
1518
- function onResponse (headers) {
1519
- const stream = this
1520
- const state = stream[kRequestStreamState]
1521
-
1522
- if (state == null) {
1523
- return
1524
- }
1525
-
1526
- const { request } = state
1527
-
1528
- stream.off('response', onResponse)
1529
-
1530
- // Final response received while still awaiting 100 (Continue): the body won't
1531
- // be sent, so close our half or the stream stays open and never completes.
1532
- if (state.body != null && !state.bodySent && !stream.writableEnded) {
1533
- stream.removeListener('continue', writeBodyH2)
1534
- stream.end()
1535
- }
1536
-
1537
- const statusCode = Number(headers[HTTP2_HEADER_STATUS])
1538
- delete headers[HTTP2_HEADER_STATUS]
1539
- request.onResponseStarted()
1540
- state.responseReceived = true
1541
-
1542
- // A Content-Length in HEAD and 304 responses describes the selected
1543
- // representation rather than DATA on this stream. Successful CONNECT uses
1544
- // the upgrade path above; all other final responses use Content-Length as
1545
- // their DATA payload length.
1546
- if (request.method !== 'HEAD' && statusCode !== 304) {
1547
- const contentLength = headers[HTTP2_HEADER_CONTENT_LENGTH]
1548
- state.responseContentLength = contentLength == null ? null : Number(contentLength)
1549
- }
1550
-
1551
- if (state.headersTimeout || state.bodyTimeout) {
1552
- stream.setTimeout(state.bodyTimeout)
1553
- }
1554
-
1555
- // Due to the stream nature, it is possible we face a race condition
1556
- // where the stream has been assigned, but the request has been aborted
1557
- // or already completed and headers hasn't been received yet. A late
1558
- // 'response' delivered after completion would call request.onResponseStart
1559
- // post-completion, tripping its `assert(!this.completed)` (an uncatchable
1560
- // throw on the http2 event tick). Guard `completed` here as onEnd/onTrailers
1561
- // already do; best effort is to release the stream immediately as there's
1562
- // no value to keep it open.
1563
- if (request.aborted || request.completed) {
1564
- releaseRequestStream(stream)
1565
- return
1566
- }
719
+ } else {
720
+ stream = session.request(headers, {
721
+ endStream: shouldEndStream,
722
+ signal
723
+ })
724
+ stream[kHTTP2Stream] = true
1567
725
 
1568
- if (request.onResponseStart(statusCode, headers, resumeResponseStream.bind(stream), '') === false) {
1569
- pauseResponseStream(stream, state)
726
+ writeBodyH2()
1570
727
  }
1571
728
 
1572
- stream.on('data', onData)
1573
- }
1574
-
1575
- function onEnd () {
1576
- const stream = this
1577
- const state = stream[kRequestStreamState]
1578
-
1579
- if (state == null) {
1580
- return
1581
- }
729
+ // Increment counter as we have new streams open
730
+ ++session[kOpenStreams]
731
+ stream.setTimeout(headersTimeout)
1582
732
 
1583
- const { request } = state
733
+ // Track whether we received a response (headers)
734
+ let responseReceived = false
735
+
736
+ stream.once('response', headers => {
737
+ const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
738
+ request.onResponseStarted()
739
+ responseReceived = true
740
+ stream.setTimeout(bodyTimeout)
741
+
742
+ // Due to the stream nature, it is possible we face a race condition
743
+ // where the stream has been assigned, but the request has been aborted
744
+ // the request remains in-flight and headers hasn't been received yet
745
+ // for those scenarios, best effort is to destroy the stream immediately
746
+ // as there's no value to keep it open.
747
+ if (request.aborted) {
748
+ stream.removeAllListeners('data')
749
+ return
750
+ }
1584
751
 
1585
- stream.off('end', onEnd)
752
+ if (request.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), '') === false) {
753
+ stream.pause()
754
+ }
1586
755
 
1587
- // onTrailers (which may fire after 'end' on Windows) has already stored
1588
- // trailers on the state by now, so completing here still delivers them.
1589
- if (state.responseReceived) {
1590
- if (!request.aborted && !request.completed) {
1591
- if (state.responseContentLength != null && state.bytesRead !== state.responseContentLength) {
1592
- state.abort(new ResponseContentLengthMismatchError())
756
+ stream.on('data', (chunk) => {
757
+ if (request.aborted || request.completed) {
1593
758
  return
1594
759
  }
1595
760
 
1596
- state.pendingEnd = true
1597
-
1598
- // Complete on 'end': a blocked event loop can keep the stream's 'close'
1599
- // from firing, stranding its buffers until OOM. Idempotent, so a later
1600
- // 'close' no-ops.
1601
- completeRequestStream.call(stream)
1602
- }
1603
- } else {
1604
- // Stream ended without receiving a response - this is an error
1605
- // (e.g., server destroyed the stream before sending headers)
1606
- state.abort(new InformationalError('HTTP/2: stream half-closed (remote)'), true)
1607
- }
1608
- }
1609
-
1610
- function retryRefusedStream (stream, state) {
1611
- const { client, request } = state
1612
-
1613
- if (
1614
- state.responseReceived ||
1615
- request.aborted ||
1616
- request.completed ||
1617
- request[kRefusedStreamRetry] ||
1618
- !canReplayRequest(request)
1619
- ) {
1620
- return false
1621
- }
1622
-
1623
- // RFC 9113 section 8.7 permits retrying REFUSED_STREAM, but says clients
1624
- // SHOULD NOT automatically retry the same request more than once.
1625
- request[kRefusedStreamRetry] = true
1626
-
1627
- // The peer only reset this stream, so the HTTP/2 session remains usable for
1628
- // the retry.
1629
- requeueStreamRequest(client, state)
1630
-
1631
- return true
1632
- }
1633
-
1634
- // nghttp2 refuses to send the HEADERS of a stream opened before a GOAWAY was
1635
- // received but flushed after it. The peer never saw the request, so it can be
1636
- // replayed on a new connection whatever its method. A GOAWAY whose
1637
- // lastStreamID covers the stream (e.g. 2^31-1, a graceful shutdown notice)
1638
- // leaves the stream attached to the session, so this is the only signal.
1639
- function retryUnsentStream (state) {
1640
- const { client, request, session } = state
1641
-
1642
- if (
1643
- !session[kReceivedGoAway] ||
1644
- state.responseReceived ||
1645
- request.aborted ||
1646
- request.completed ||
1647
- !canReplayRequest(request) ||
1648
- !registerGoAwayRefusal(request)
1649
- ) {
1650
- return false
1651
- }
1652
-
1653
- requeueStreamRequest(client, state)
1654
-
1655
- return true
1656
- }
1657
-
1658
- function requeueStreamRequest (client, state) {
1659
- const { request } = state
1660
-
1661
- // Detach the failed attempt before moving the request back to the pending
1662
- // queue. Severing also drops the 'close' listener, so the abandoned stream
1663
- // cannot later complete the retried request.
1664
- detachRequestStreamForClose(request)
1665
- state.stream = null
1666
- state.requestFinalized = true
1667
-
1668
- completeRequest(client, request)
1669
- client[kQueue].splice(client[kPendingIdx], 0, request)
1670
- client[kResume]()
1671
- }
1672
-
1673
- function onError (err) {
1674
- const stream = this
1675
- const state = stream[kRequestStreamState]
1676
-
1677
- if (state == null) {
1678
- return
1679
- }
1680
-
1681
- stream.off('error', onError)
1682
- // #5936: The stream has already errored, but Node may destroy it again with a
1683
- // session-level error before the native handle is released. Keep a persistent
1684
- // noop error sink so that re-delivery cannot go unhandled.
1685
- stream.on('error', noop)
1686
-
1687
- // Node's HTTP/2 implementation can turn an incomplete Content-Length body
1688
- // into a protocol stream error instead of emitting 'end'. Prefer the
1689
- // content-length mismatch error when the received byte count proves it.
1690
- if (state.responseContentLength != null && state.bytesRead !== state.responseContentLength) {
1691
- err = new ResponseContentLengthMismatchError()
1692
- }
1693
-
1694
- if (typeof stream.rstCode === 'number' && stream.rstCode !== NGHTTP2_NO_ERROR) {
1695
- err.http2ErrorCode = stream.rstCode
1696
- }
1697
-
1698
- if (
1699
- stream.rstCode === NGHTTP2_REFUSED_STREAM &&
1700
- retryRefusedStream(stream, state)
1701
- ) {
1702
- return
1703
- }
1704
-
1705
- state.abort(err)
1706
- }
1707
-
1708
- function onFrameError (type, code) {
1709
- const stream = this
1710
- const state = stream[kRequestStreamState]
1711
-
1712
- if (state == null) {
1713
- return
1714
- }
1715
-
1716
- stream.off('frameError', onFrameError)
1717
-
1718
- if (type === HTTP2_FRAME_TYPE_HEADERS && retryUnsentStream(state)) {
1719
- return
1720
- }
761
+ if (request.onData(chunk) === false) {
762
+ stream.pause()
763
+ }
764
+ })
765
+ })
1721
766
 
1722
- state.abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`))
1723
- }
767
+ stream.once('end', () => {
768
+ stream.removeAllListeners('data')
769
+ // If we received a response, this is a normal completion
770
+ if (responseReceived) {
771
+ if (!request.aborted && !request.completed) {
772
+ request.onComplete({})
773
+ }
1724
774
 
1725
- function onAborted () {
1726
- this.off('data', onData)
1727
- }
775
+ completeRequest(client, request)
776
+ client[kResume]()
777
+ } else {
778
+ // Stream ended without receiving a response - this is an error
779
+ // (e.g., server destroyed the stream before sending headers)
780
+ abort(new InformationalError('HTTP/2: stream half-closed (remote)'))
781
+ completeRequest(client, request, true)
782
+ client[kResume]()
783
+ }
784
+ })
1728
785
 
1729
- function onTimeout () {
1730
- const stream = this
1731
- const state = stream[kRequestStreamState]
786
+ stream.once('close', () => {
787
+ stream.removeAllListeners('data')
788
+ session[kOpenStreams] -= 1
789
+ if (session[kOpenStreams] === 0) {
790
+ session.unref()
791
+ }
1732
792
 
1733
- if (state == null) {
1734
- return
1735
- }
793
+ // A stream can close without ever emitting 'end' or 'error': a peer's
794
+ // RST_STREAM(CANCEL) received before the response is reported by Node as a
795
+ // bare 'close', and destroying the stream unenrolls its timeout, so no
796
+ // 'timeout' follows either. Nothing else would ever settle this request.
797
+ if (!request.aborted && !request.completed) {
798
+ abort(new InformationalError('HTTP/2: stream closed before the response was complete'))
799
+ }
800
+ })
1736
801
 
1737
- // Remove self so timeout doesn't fire again after we handle it
1738
- stream.off('timeout', onTimeout)
802
+ stream.once('error', function (err) {
803
+ stream.removeAllListeners('data')
804
+ abort(err)
805
+ })
1739
806
 
1740
- const { responseReceived, session, bodyTimeout, headersTimeout } = state
1741
- const err = responseReceived
1742
- ? new BodyTimeoutError(`HTTP/2: "stream timeout after ${bodyTimeout}"`)
1743
- : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${headersTimeout}"`)
807
+ stream.once('frameError', (type, code) => {
808
+ stream.removeAllListeners('data')
809
+ abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`))
810
+ })
1744
811
 
1745
- // Probe before aborting: completing the request resumes the queue, which
1746
- // must not open new streams until the peer has proven it is alive.
1747
- probeHttp2Session(session, responseReceived ? bodyTimeout : headersTimeout)
1748
- state.abort(err)
1749
- }
812
+ stream.on('aborted', () => {
813
+ stream.removeAllListeners('data')
814
+ })
1750
815
 
1751
- function onTrailers (trailers) {
1752
- const stream = this
1753
- const state = stream[kRequestStreamState]
816
+ stream.on('timeout', () => {
817
+ const err = responseReceived
818
+ ? new BodyTimeoutError(`HTTP/2: "body timeout after ${bodyTimeout}"`)
819
+ : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${headersTimeout}"`)
820
+ stream.removeAllListeners('data')
821
+ session[kOpenStreams] -= 1
1754
822
 
1755
- if (state == null) {
1756
- return
1757
- }
823
+ if (session[kOpenStreams] === 0) {
824
+ session.unref()
825
+ }
1758
826
 
1759
- const { request } = state
827
+ abort(err)
828
+ })
1760
829
 
1761
- stream.off('trailers', onTrailers)
1762
- stream.off('data', onData)
830
+ stream.once('trailers', trailers => {
831
+ if (request.aborted || request.completed) {
832
+ return
833
+ }
1763
834
 
1764
- if (request.aborted || request.completed) {
1765
- return
1766
- }
835
+ stream.removeAllListeners('data')
836
+ request.onComplete(trailers)
837
+ })
1767
838
 
1768
- // Store trailers for completeRequestStream to use when completing
1769
- state.trailers = trailers
1770
- }
839
+ return true
1771
840
 
1772
- function writeBodyH2 () {
1773
- const stream = this
1774
- const state = stream[kRequestStreamState]
1775
- state.bodySent = true
1776
- const { abort, body, client, contentLength, expectsPayload, request } = state
1777
-
1778
- if (!body || contentLength === 0) {
1779
- writeBuffer(
1780
- abort,
1781
- stream,
1782
- null,
1783
- client,
1784
- request,
1785
- client[kSocket],
1786
- contentLength,
1787
- expectsPayload
1788
- )
1789
- } else if (util.isBuffer(body)) {
1790
- writeBuffer(
1791
- abort,
1792
- stream,
1793
- body,
1794
- client,
1795
- request,
1796
- client[kSocket],
1797
- contentLength,
1798
- expectsPayload
1799
- )
1800
- } else if (util.isBlobLike(body)) {
1801
- if (typeof body.stream === 'function') {
1802
- writeIterable(
841
+ function writeBodyH2 () {
842
+ if (!body || contentLength === 0) {
843
+ writeBuffer(
1803
844
  abort,
1804
845
  stream,
1805
- body.stream(),
846
+ null,
1806
847
  client,
1807
848
  request,
1808
849
  client[kSocket],
1809
850
  contentLength,
1810
851
  expectsPayload
1811
852
  )
1812
- } else {
1813
- writeBlob(
853
+ } else if (util.isBuffer(body)) {
854
+ writeBuffer(
1814
855
  abort,
1815
856
  stream,
1816
857
  body,
@@ -1820,31 +861,55 @@ function writeBodyH2 () {
1820
861
  contentLength,
1821
862
  expectsPayload
1822
863
  )
864
+ } else if (util.isBlobLike(body)) {
865
+ if (typeof body.stream === 'function') {
866
+ writeIterable(
867
+ abort,
868
+ stream,
869
+ body.stream(),
870
+ client,
871
+ request,
872
+ client[kSocket],
873
+ contentLength,
874
+ expectsPayload
875
+ )
876
+ } else {
877
+ writeBlob(
878
+ abort,
879
+ stream,
880
+ body,
881
+ client,
882
+ request,
883
+ client[kSocket],
884
+ contentLength,
885
+ expectsPayload
886
+ )
887
+ }
888
+ } else if (util.isStream(body)) {
889
+ writeStream(
890
+ abort,
891
+ client[kSocket],
892
+ expectsPayload,
893
+ stream,
894
+ body,
895
+ client,
896
+ request,
897
+ contentLength
898
+ )
899
+ } else if (util.isIterable(body)) {
900
+ writeIterable(
901
+ abort,
902
+ stream,
903
+ body,
904
+ client,
905
+ request,
906
+ client[kSocket],
907
+ contentLength,
908
+ expectsPayload
909
+ )
910
+ } else {
911
+ assert(false)
1823
912
  }
1824
- } else if (util.isStream(body)) {
1825
- writeStream(
1826
- abort,
1827
- client[kSocket],
1828
- expectsPayload,
1829
- stream,
1830
- body,
1831
- client,
1832
- request,
1833
- contentLength
1834
- )
1835
- } else if (util.isIterable(body)) {
1836
- writeIterable(
1837
- abort,
1838
- stream,
1839
- body,
1840
- client,
1841
- request,
1842
- client[kSocket],
1843
- contentLength,
1844
- expectsPayload
1845
- )
1846
- } else {
1847
- assert(false)
1848
913
  }
1849
914
  }
1850
915
 
@@ -1903,6 +968,8 @@ function writeStream (abort, socket, expectsPayload, h2stream, body, client, req
1903
968
  }
1904
969
 
1905
970
  async function writeBlob (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
971
+ assert(contentLength === body.size, 'blob body must have content length')
972
+
1906
973
  try {
1907
974
  if (contentLength != null && contentLength !== body.size) {
1908
975
  throw new RequestContentLengthMismatchError()