@yanglaofish/fishtools 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -11
- package/manual/README.md +23 -11
- package/manual/docs/deployment.md +3 -3
- package/manual/docs/examples/action-plugin/package.json +1 -1
- package/manual/docs/plugin-development.md +15 -4
- package/manual/docs/releases.md +24 -0
- package/manual/docs/superpowers/plans/2026-10-13-command-shortcuts.md +3 -2
- package/manual/docs/superpowers/plans/2026-10-13-global-plugins.md +56 -0
- package/manual/docs/superpowers/plans/2026-10-13-tui-readable-sessions.md +21 -0
- package/manual/docs/superpowers/reviews/2026-10-13-0.5.3-review.md +28 -0
- package/manual/docs/superpowers/reviews/2026-10-13-command-shortcuts-review.md +7 -0
- package/manual/docs/superpowers/reviews/2026-10-13-tui-sessions-review.md +55 -0
- package/manual/docs/superpowers/specs/2026-10-13-issue-4-workflow-menu.md +23 -0
- package/manual/docs/superpowers/specs/2026-10-13-issue-5-results-and-history.md +20 -0
- package/manual/docs/terminal-commands.md +8 -0
- package/manual/docs/verification.md +30 -0
- package/manual/packages/core/README.md +2 -0
- package/manual/packages/core/package.json +1 -1
- package/manual/packages/core/src/application.js +100 -51
- package/manual/packages/core/src/development-watch-worker.js +10 -1
- package/manual/packages/core/src/development.js +1 -1
- package/manual/packages/core/src/plugin-catalog.js +42 -0
- package/manual/packages/core/src/version.js +1 -1
- package/manual/packages/fst-cli/README.md +4 -0
- package/manual/packages/fst-cli/bin/fst.js +7 -6
- package/manual/packages/fst-cli/package.json +1 -1
- package/manual/packages/fst-cli/src/development.js +6 -1
- package/manual/packages/fst-cli/src/terminal/command-menu.js +8 -3
- package/manual/packages/fst-cli/src/terminal/navigation.js +2 -0
- package/manual/packages/fst-cli/src/terminal/presentation.js +4 -3
- package/manual/packages/fst-cli/src/terminal/run-feed.js +69 -13
- package/manual/packages/fst-cli/src/terminal/run-presentation.js +55 -12
- package/manual/packages/fst-cli/src/terminal/run-viewer.js +26 -10
- package/manual/packages/fst-cli/src/terminal/session-history.js +82 -0
- package/manual/packages/fst-cli/src/terminal/session.js +119 -40
- package/manual/packages/fst-cli/src/terminal/view.js +31 -8
- package/manual/packages/fst-cli/src/terminal/workflow-menu.js +14 -9
- package/manual/packages/fst-devtools/package.json +2 -2
- package/manual/packages/fst-devtools/src/plugin-tools.js +1 -1
- package/manual/packages/fst-logs/README.md +23 -2
- package/manual/packages/fst-logs/package.json +2 -1
- package/manual/packages/fst-logs/src/file-identity.js +23 -0
- package/manual/packages/fst-logs/src/markdown-log.js +4 -3
- package/manual/packages/fst-logs/src/run-logs.js +3 -2
- package/manual/packages/fst-logs/src/session-history.js +180 -0
- package/manual/packages/fst-platform/README.md +4 -0
- package/manual/packages/fst-platform/package.json +3 -3
- package/manual/packages/fst-platform/src/process.js +4 -1
- package/manual/packages/fst-platform/src/shell.js +46 -1
- package/manual/packages/fst-plugin/package.json +1 -1
- package/manual/packages/fst-plugin/src/host.js +31 -23
- package/manual/packages/fst-workflow/package.json +1 -1
- package/manual/packages/fst-workflow/src/engine.js +1 -1
- package/manual/packages/fst-workspace/README.md +2 -0
- package/manual/packages/fst-workspace/package.json +2 -1
- package/manual/packages/fst-workspace/src/plugin-registry.js +58 -0
- package/manual/packages/fst-workspace/src/plugins.js +7 -4
- package/manual/packages/fst-workspace/src/workflows.js +5 -3
- package/manual/packages/pack/package.json +3 -3
- package/manual/packages/pack/runtime-cache.js +26 -0
- package/manual/packages/pack/runtime.js +6 -10
- package/manual/plugins/commands/package.json +1 -1
- package/node_modules/@mytools/commands/package.json +1 -1
- package/node_modules/@mytools/core/README.md +2 -0
- package/node_modules/@mytools/core/package.json +1 -1
- package/node_modules/@mytools/core/src/application.js +100 -51
- package/node_modules/@mytools/core/src/development-watch-worker.js +10 -1
- package/node_modules/@mytools/core/src/development.js +1 -1
- package/node_modules/@mytools/core/src/plugin-catalog.js +42 -0
- package/node_modules/@mytools/core/src/version.js +1 -1
- package/node_modules/@mytools/fst-cli/README.md +4 -0
- package/node_modules/@mytools/fst-cli/bin/fst.js +7 -6
- package/node_modules/@mytools/fst-cli/package.json +1 -1
- package/node_modules/@mytools/fst-cli/src/development.js +6 -1
- package/node_modules/@mytools/fst-cli/src/terminal/command-menu.js +8 -3
- package/node_modules/@mytools/fst-cli/src/terminal/navigation.js +2 -0
- package/node_modules/@mytools/fst-cli/src/terminal/presentation.js +4 -3
- package/node_modules/@mytools/fst-cli/src/terminal/run-feed.js +69 -13
- package/node_modules/@mytools/fst-cli/src/terminal/run-presentation.js +55 -12
- package/node_modules/@mytools/fst-cli/src/terminal/run-viewer.js +26 -10
- package/node_modules/@mytools/fst-cli/src/terminal/session-history.js +82 -0
- package/node_modules/@mytools/fst-cli/src/terminal/session.js +119 -40
- package/node_modules/@mytools/fst-cli/src/terminal/view.js +31 -8
- package/node_modules/@mytools/fst-cli/src/terminal/workflow-menu.js +14 -9
- package/node_modules/@mytools/fst-devtools/package.json +2 -2
- package/node_modules/@mytools/fst-devtools/src/plugin-tools.js +1 -1
- package/node_modules/@mytools/fst-logs/README.md +23 -2
- package/node_modules/@mytools/fst-logs/package.json +2 -1
- package/node_modules/@mytools/fst-logs/src/file-identity.js +23 -0
- package/node_modules/@mytools/fst-logs/src/markdown-log.js +4 -3
- package/node_modules/@mytools/fst-logs/src/run-logs.js +3 -2
- package/node_modules/@mytools/fst-logs/src/session-history.js +180 -0
- package/node_modules/@mytools/fst-platform/README.md +4 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/LICENSE +21 -0
- package/node_modules/{undici/docs/docs/index.md → @mytools/fst-platform/node_modules/undici/README.md} +85 -137
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Agent.md +84 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Client.md +288 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Cookies.md +128 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +317 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Dispatcher.md +1393 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Fetch.md +60 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockClient.md +81 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockPool.md +555 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/docs/docs/best-practices/crawling.md +1 -3
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/docs/docs/best-practices/undici-vs-builtin-fetch.md +8 -10
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/index-fetch.js +65 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/index.d.ts +3 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/index.js +234 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-connect.js +110 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-request.js +214 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-stream.js +209 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/readable.js +580 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/cache/memory-cache-store.js +3 -3
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/cache/sqlite-cache-store.js +1 -3
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/connect.js +153 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/constants.js +143 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/errors.js +477 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/request.js +485 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/symbols.js +75 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/tree.js +160 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/util.js +992 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/agent.js +158 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/balanced-pool.js +221 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/client-h1.js +1746 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/client-h2.js +1060 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/client.js +668 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/dispatcher/h2c-client.js +4 -4
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/dispatcher/round-robin-pool.js +10 -32
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/dispatcher/socks5-proxy-agent.js +63 -153
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/global.js +59 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/handler/cache-handler.js +7 -49
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/handler/cache-revalidation-handler.js +0 -10
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/handler/deduplication-handler.js +10 -29
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/redirect-handler.js +238 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/retry-handler.js +504 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/interceptor/cache.js +26 -79
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/interceptor/decompress.js +3 -13
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/interceptor/deduplicate.js +4 -5
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/dump.js +99 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/mock-call-history.js +1 -1
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/snapshot-agent.js +7 -25
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/snapshot-recorder.js +3 -38
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/cache.js +10 -92
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/util/promise.js +28 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/runtime-features.js +34 -3
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/util/timers.js +425 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/parse.js +314 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/util.js +352 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/eventsource/eventsource-stream.js +494 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/index.js +2413 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/util.js +1522 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/infra/index.js +1 -16
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/webidl/index.js +21 -7
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/connection.js +339 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/receiver.js +507 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/websocket/stream/websocketerror.js +10 -13
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/websocket/stream/websocketstream.js +14 -29
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/websocket.js +758 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/package.json +152 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/scripts/strip-comments.js +10 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/README.md +6 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/agent.d.ts +32 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/client.d.ts +139 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/connector.d.ts +36 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/cookies.d.ts +30 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/dispatcher.d.ts +275 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/errors.d.ts +177 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/eventsource.d.ts +66 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/fetch.d.ts +231 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/formdata.d.ts +114 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/h2c-client.d.ts +6 -6
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/handlers.d.ts +14 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/header.d.ts +160 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/index.d.ts +91 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/interceptors.d.ts +82 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-client.d.ts +27 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-interceptor.d.ts +94 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/patch.d.ts +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/pool.d.ts +41 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/readable.d.ts +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/round-robin-pool.d.ts +2 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/snapshot-agent.d.ts +0 -4
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/socks5-proxy-agent.d.ts +2 -4
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/webidl.d.ts +347 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/websocket.d.ts +188 -0
- package/node_modules/@mytools/fst-platform/package.json +3 -3
- package/node_modules/@mytools/fst-platform/src/process.js +4 -1
- package/node_modules/@mytools/fst-platform/src/shell.js +46 -1
- package/node_modules/@mytools/fst-plugin/package.json +1 -1
- package/node_modules/@mytools/fst-plugin/src/host.js +31 -23
- package/node_modules/@mytools/fst-workflow/package.json +1 -1
- package/node_modules/@mytools/fst-workflow/src/engine.js +1 -1
- package/node_modules/@mytools/fst-workspace/README.md +2 -0
- package/node_modules/@mytools/fst-workspace/package.json +2 -1
- package/node_modules/@mytools/fst-workspace/src/plugin-registry.js +58 -0
- package/node_modules/@mytools/fst-workspace/src/plugins.js +7 -4
- package/node_modules/@mytools/fst-workspace/src/workflows.js +5 -3
- package/node_modules/@mytools/pack/package.json +3 -3
- package/node_modules/@mytools/pack/runtime-cache.js +26 -0
- package/node_modules/@mytools/pack/runtime.js +6 -10
- package/node_modules/@mytools/web/public/THIRD_PARTY_NOTICES.txt +953 -963
- package/node_modules/@npmcli/agent/lib/agents.js +0 -10
- package/node_modules/@npmcli/agent/package.json +12 -11
- package/node_modules/@npmcli/arborist/README.md +2 -2
- package/node_modules/@npmcli/arborist/bin/index.js +2 -1
- package/node_modules/@npmcli/arborist/bin/shrinkwrap.js +7 -0
- package/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +25 -159
- package/node_modules/@npmcli/arborist/lib/arborist/isolated-reifier.js +49 -11
- package/node_modules/@npmcli/arborist/lib/arborist/load-actual.js +0 -67
- package/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js +37 -5
- package/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +8 -15
- package/node_modules/@npmcli/arborist/lib/arborist/reify.js +42 -59
- package/node_modules/@npmcli/arborist/lib/consistent-resolve.js +1 -1
- package/node_modules/@npmcli/arborist/lib/diff.js +22 -17
- package/node_modules/@npmcli/arborist/lib/edge.js +2 -22
- package/node_modules/@npmcli/arborist/lib/index.js +0 -2
- package/node_modules/@npmcli/arborist/lib/isolated-classes.js +1 -4
- package/node_modules/@npmcli/arborist/lib/node.js +9 -13
- package/node_modules/@npmcli/arborist/lib/place-dep.js +0 -6
- package/node_modules/@npmcli/arborist/lib/printable.js +5 -0
- package/node_modules/@npmcli/arborist/lib/shrinkwrap.js +32 -55
- package/node_modules/@npmcli/arborist/package.json +26 -32
- package/node_modules/@npmcli/fs/lib/move-file.js +5 -5
- package/node_modules/@npmcli/fs/package.json +5 -5
- package/node_modules/@npmcli/git/package.json +12 -13
- package/node_modules/@npmcli/installed-package-contents/package.json +7 -7
- package/node_modules/@npmcli/map-workspaces/package.json +7 -7
- package/node_modules/@npmcli/metavuln-calculator/package.json +16 -10
- package/node_modules/@npmcli/name-from-folder/package.json +16 -13
- package/node_modules/@npmcli/node-gyp/package.json +5 -5
- package/node_modules/@npmcli/package-json/lib/index.js +1 -2
- package/node_modules/@npmcli/package-json/lib/normalize.js +22 -23
- package/node_modules/@npmcli/package-json/package.json +10 -11
- package/node_modules/@npmcli/promise-spawn/README.md +2 -1
- package/node_modules/@npmcli/promise-spawn/package.json +5 -5
- package/node_modules/@npmcli/redact/package.json +4 -4
- package/node_modules/@npmcli/run-script/lib/is-server-package.js +11 -0
- package/node_modules/@npmcli/run-script/lib/make-spawn-args.js +6 -5
- package/node_modules/@npmcli/run-script/lib/run-script-pkg.js +13 -4
- package/node_modules/@npmcli/run-script/lib/run-script.js +2 -1
- package/node_modules/@npmcli/run-script/package.json +11 -12
- package/node_modules/@sigstore/bundle/README.md +1 -1
- package/node_modules/@sigstore/bundle/dist/error.js +0 -1
- package/node_modules/@sigstore/bundle/package.json +2 -2
- package/node_modules/@sigstore/core/README.md +1 -1
- package/node_modules/@sigstore/core/dist/asn1/length.js +1 -12
- package/node_modules/@sigstore/core/dist/asn1/obj.js +7 -25
- package/node_modules/@sigstore/core/dist/asn1/parse.js +5 -24
- package/node_modules/@sigstore/core/package.json +2 -2
- package/node_modules/@sigstore/sign/README.md +1 -1
- package/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js +1 -1
- package/node_modules/@sigstore/sign/package.json +9 -9
- package/node_modules/@sigstore/tuf/README.md +1 -1
- package/node_modules/@sigstore/tuf/package.json +4 -4
- package/node_modules/@sigstore/tuf/seeds.json +1 -1
- package/node_modules/@sigstore/verify/README.md +1 -1
- package/node_modules/@sigstore/verify/dist/bundle/dsse.d.ts +0 -1
- package/node_modules/@sigstore/verify/dist/bundle/dsse.js +0 -6
- package/node_modules/@sigstore/verify/dist/bundle/message.d.ts +0 -1
- package/node_modules/@sigstore/verify/dist/bundle/message.js +0 -5
- package/node_modules/@sigstore/verify/dist/policy.d.ts +1 -1
- package/node_modules/@sigstore/verify/dist/policy.js +2 -0
- package/node_modules/@sigstore/verify/dist/shared.types.d.ts +1 -6
- package/node_modules/@sigstore/verify/dist/tlog/checkpoint.js +3 -17
- package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js +4 -4
- package/node_modules/@sigstore/verify/dist/tlog/index.js +1 -13
- package/node_modules/@sigstore/verify/dist/tlog/merkle.js +1 -12
- package/node_modules/@sigstore/verify/dist/verifier.js +5 -13
- package/node_modules/@sigstore/verify/package.json +5 -5
- package/node_modules/@tufjs/models/package.json +3 -3
- package/node_modules/abbrev/package.json +8 -9
- package/node_modules/agent-base/dist/helpers.d.ts +5 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -1
- package/node_modules/agent-base/dist/helpers.js +34 -5
- package/node_modules/agent-base/dist/helpers.js.map +1 -1
- package/node_modules/agent-base/dist/index.d.ts +5 -1
- package/node_modules/agent-base/dist/index.d.ts.map +1 -1
- package/node_modules/agent-base/dist/index.js +40 -8
- package/node_modules/agent-base/dist/index.js.map +1 -1
- package/node_modules/agent-base/package.json +12 -12
- package/node_modules/bin-links/README.md +4 -5
- package/node_modules/bin-links/lib/fix-bin.js +1 -3
- package/node_modules/bin-links/lib/index.js +16 -8
- package/node_modules/bin-links/lib/link-mans.js +53 -0
- package/node_modules/bin-links/package.json +12 -11
- package/node_modules/cacache/lib/content/write.js +0 -2
- package/node_modules/cacache/lib/entry-index.js +0 -3
- package/node_modules/cacache/lib/rm.js +0 -1
- package/node_modules/cacache/lib/util/tmp.js +1 -5
- package/node_modules/cacache/lib/verify.js +2 -2
- package/node_modules/cacache/package.json +7 -7
- package/node_modules/cmd-shim/lib/index.js +32 -67
- package/node_modules/cmd-shim/package.json +5 -5
- package/node_modules/hosted-git-info/README.md +1 -1
- package/node_modules/hosted-git-info/lib/parse-url.js +3 -1
- package/node_modules/hosted-git-info/package.json +4 -4
- package/node_modules/http-proxy-agent/dist/index.d.ts +5 -8
- package/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -1
- package/node_modules/http-proxy-agent/dist/index.js +42 -26
- package/node_modules/http-proxy-agent/dist/index.js.map +1 -1
- package/node_modules/http-proxy-agent/package.json +14 -15
- package/node_modules/https-proxy-agent/dist/index.d.ts +5 -9
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -1
- package/node_modules/https-proxy-agent/dist/index.js +44 -98
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +3 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +10 -3
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -1
- package/node_modules/https-proxy-agent/package.json +15 -16
- package/node_modules/ignore-walk/package.json +4 -4
- package/node_modules/ini/package.json +5 -5
- package/node_modules/ip-address/README.md +70 -70
- package/node_modules/ip-address/dist/ipv6.js +7 -4
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +3 -0
- package/node_modules/ip-address/dist/v6/constants.js +3 -0
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +2 -1
- package/node_modules/json-parse-even-better-errors/lib/index.js +1 -3
- package/node_modules/json-parse-even-better-errors/package.json +17 -13
- package/node_modules/make-fetch-happen/package.json +11 -11
- package/node_modules/minipass-fetch/package.json +4 -4
- package/node_modules/node-gyp/.release-please-manifest.json +1 -1
- package/node_modules/node-gyp/CHANGELOG.md +0 -102
- package/node_modules/node-gyp/README.md +2 -3
- package/node_modules/node-gyp/eslint.config.js +1 -4
- package/node_modules/node-gyp/gyp/.release-please-manifest.json +1 -1
- package/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +19 -14
- package/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +2 -7
- package/node_modules/node-gyp/gyp/pyproject.toml +1 -1
- package/node_modules/node-gyp/lib/build.js +6 -18
- package/node_modules/node-gyp/lib/create-config-gypi.js +0 -5
- package/node_modules/node-gyp/lib/node-gyp.js +2 -9
- package/node_modules/node-gyp/lib/rebuild.js +3 -3
- package/node_modules/node-gyp/package.json +9 -11
- package/node_modules/nopt/README.md +4 -2
- package/node_modules/nopt/lib/debug.js +5 -0
- package/node_modules/nopt/lib/nopt-lib.js +43 -7
- package/node_modules/nopt/lib/nopt.js +4 -2
- package/node_modules/nopt/lib/type-defs.js +13 -8
- package/node_modules/nopt/package.json +17 -15
- package/node_modules/npm-bundled/package.json +6 -6
- package/node_modules/npm-install-checks/package.json +5 -5
- package/node_modules/npm-normalize-package-bin/package.json +16 -13
- package/node_modules/npm-package-arg/package.json +7 -7
- package/node_modules/npm-packlist/README.md +30 -45
- package/node_modules/npm-packlist/lib/index.js +47 -115
- package/node_modules/npm-packlist/package.json +8 -10
- package/node_modules/npm-pick-manifest/package.json +19 -15
- package/node_modules/npm-registry-fetch/lib/errors.js +3 -8
- package/node_modules/npm-registry-fetch/package.json +12 -12
- package/node_modules/pacote/lib/dir.js +5 -60
- package/node_modules/pacote/lib/fetcher.js +0 -4
- package/node_modules/pacote/lib/git.js +3 -11
- package/node_modules/pacote/lib/util/add-git-sha.js +1 -1
- package/node_modules/pacote/package.json +18 -19
- package/node_modules/parse-conflict-json/package.json +6 -6
- package/node_modules/proc-log/package.json +4 -4
- package/node_modules/read-cmd-shim/lib/index.js +1 -1
- package/node_modules/read-cmd-shim/package.json +18 -14
- package/node_modules/sigstore/README.md +1 -1
- package/node_modules/sigstore/package.json +10 -10
- package/node_modules/socks-proxy-agent/dist/index.d.ts +3 -1
- package/node_modules/socks-proxy-agent/dist/index.d.ts.map +1 -1
- package/node_modules/socks-proxy-agent/dist/index.js +43 -17
- package/node_modules/socks-proxy-agent/dist/index.js.map +1 -1
- package/node_modules/socks-proxy-agent/package.json +15 -15
- package/node_modules/ssri/package.json +4 -4
- package/node_modules/tuf-js/dist/config.d.ts +2 -2
- package/node_modules/tuf-js/dist/fetcher.d.ts +4 -4
- package/node_modules/tuf-js/dist/fetcher.js +16 -55
- package/node_modules/tuf-js/dist/updater.js +2 -2
- package/node_modules/tuf-js/package.json +8 -8
- package/node_modules/undici/README.md +72 -405
- package/node_modules/undici/docs/docs/api/Agent.md +41 -252
- package/node_modules/undici/docs/docs/api/BalancedPool.md +48 -246
- package/node_modules/undici/docs/docs/api/CacheStorage.md +13 -171
- package/node_modules/undici/docs/docs/api/Client.md +139 -395
- package/node_modules/undici/docs/docs/api/Connector.md +35 -118
- package/node_modules/undici/docs/docs/api/ContentType.md +25 -65
- package/node_modules/undici/docs/docs/api/Cookies.md +47 -125
- package/node_modules/undici/docs/docs/api/Debug.md +31 -47
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +97 -409
- package/node_modules/undici/docs/docs/api/DispatchInterceptor.md +60 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1011 -500
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +96 -105
- package/node_modules/undici/docs/docs/api/Errors.md +28 -528
- package/node_modules/undici/docs/docs/api/EventSource.md +13 -326
- package/node_modules/undici/docs/docs/api/Fetch.md +24 -693
- package/node_modules/undici/docs/docs/api/MockAgent.md +264 -346
- package/node_modules/undici/docs/docs/api/MockClient.md +31 -153
- package/node_modules/undici/docs/docs/api/MockErrors.md +5 -56
- package/node_modules/undici/docs/docs/api/MockPool.md +253 -324
- package/node_modules/undici/docs/docs/api/Pool.md +41 -235
- package/node_modules/undici/docs/docs/api/PoolStats.md +13 -119
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +81 -198
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +58 -238
- package/node_modules/undici/docs/docs/api/RetryAgent.md +28 -119
- package/node_modules/undici/docs/docs/api/RetryHandler.md +78 -161
- package/node_modules/undici/docs/docs/api/Util.md +11 -68
- package/node_modules/undici/docs/docs/api/WebSocket.md +24 -509
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +33 -101
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -2
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +2 -58
- package/node_modules/undici/docs/docs/best-practices/proxy.md +1 -3
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -45
- package/node_modules/undici/index-fetch.js +4 -34
- package/node_modules/undici/index.d.ts +1 -1
- package/node_modules/undici/index.js +20 -87
- package/node_modules/undici/lib/api/abort-signal.js +0 -2
- package/node_modules/undici/lib/api/api-connect.js +11 -15
- package/node_modules/undici/lib/api/api-pipeline.js +19 -33
- package/node_modules/undici/lib/api/api-request.js +59 -89
- package/node_modules/undici/lib/api/api-stream.js +64 -114
- package/node_modules/undici/lib/api/api-upgrade.js +13 -26
- package/node_modules/undici/lib/api/readable.js +87 -317
- package/node_modules/undici/lib/api/util.js +93 -0
- package/node_modules/undici/lib/core/connect.js +125 -77
- package/node_modules/undici/lib/core/constants.js +9 -11
- package/node_modules/undici/lib/core/diagnostics.js +129 -154
- package/node_modules/undici/lib/core/errors.js +50 -122
- package/node_modules/undici/lib/core/request.js +87 -172
- package/node_modules/undici/lib/core/symbols.js +2 -14
- package/node_modules/undici/lib/core/tree.js +2 -10
- package/node_modules/undici/lib/core/util.js +190 -481
- package/node_modules/undici/lib/dispatcher/agent.js +35 -83
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +38 -46
- package/node_modules/undici/lib/dispatcher/client-h1.js +199 -492
- package/node_modules/undici/lib/dispatcher/client-h2.js +380 -1409
- package/node_modules/undici/lib/dispatcher/client.js +130 -253
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +52 -50
- package/node_modules/undici/lib/dispatcher/dispatcher.js +24 -17
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +45 -75
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +50 -68
- package/node_modules/undici/lib/dispatcher/pool-base.js +54 -153
- package/node_modules/undici/lib/dispatcher/pool-stats.js +34 -0
- package/node_modules/undici/lib/dispatcher/pool.js +16 -135
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +41 -175
- package/node_modules/undici/lib/dispatcher/retry-agent.js +0 -3
- package/node_modules/undici/lib/global.js +9 -59
- package/node_modules/undici/lib/handler/decorator-handler.js +15 -43
- package/node_modules/undici/lib/handler/redirect-handler.js +116 -127
- package/node_modules/undici/lib/handler/retry-handler.js +182 -398
- package/node_modules/undici/lib/interceptor/dns.js +47 -254
- package/node_modules/undici/lib/interceptor/dump.js +56 -32
- package/node_modules/undici/lib/interceptor/redirect-interceptor.js +21 -0
- package/node_modules/undici/lib/interceptor/redirect.js +14 -11
- package/node_modules/undici/lib/interceptor/response-error.js +22 -31
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/llhttp/constants.js +193 -446
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -11
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -11
- package/node_modules/undici/lib/llhttp/utils.js +12 -9
- package/node_modules/undici/lib/mock/mock-agent.js +22 -106
- package/node_modules/undici/lib/mock/mock-client.js +4 -13
- package/node_modules/undici/lib/mock/mock-errors.js +2 -3
- package/node_modules/undici/lib/mock/mock-interceptor.js +13 -33
- package/node_modules/undici/lib/mock/mock-pool.js +4 -13
- package/node_modules/undici/lib/mock/mock-symbols.js +1 -10
- package/node_modules/undici/lib/mock/mock-utils.js +51 -404
- package/node_modules/undici/lib/mock/pluralizer.js +29 -0
- package/node_modules/undici/lib/util/timers.js +9 -11
- package/node_modules/undici/lib/web/cache/cache.js +51 -63
- package/node_modules/undici/lib/web/cache/cachestorage.js +7 -13
- package/node_modules/undici/lib/web/cache/symbols.js +5 -0
- package/node_modules/undici/lib/web/cookies/index.js +18 -45
- package/node_modules/undici/lib/web/cookies/parse.js +149 -157
- package/node_modules/undici/lib/web/cookies/util.js +2 -4
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +9 -37
- package/node_modules/undici/lib/web/eventsource/eventsource.js +64 -108
- package/node_modules/undici/lib/web/eventsource/util.js +5 -28
- package/node_modules/undici/lib/web/fetch/body.js +148 -173
- package/node_modules/undici/lib/web/fetch/constants.js +6 -13
- package/node_modules/undici/lib/web/fetch/data-url.js +167 -19
- package/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
- package/node_modules/undici/lib/web/fetch/file.js +126 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +117 -229
- package/node_modules/undici/lib/web/fetch/formdata.js +65 -85
- package/node_modules/undici/lib/web/fetch/headers.js +108 -143
- package/node_modules/undici/lib/web/fetch/index.js +446 -627
- package/node_modules/undici/lib/web/fetch/request.js +115 -217
- package/node_modules/undici/lib/web/fetch/response.js +82 -110
- package/node_modules/undici/lib/web/fetch/symbols.js +9 -0
- package/node_modules/undici/lib/web/fetch/util.js +393 -291
- package/node_modules/undici/lib/web/fetch/webidl.js +695 -0
- package/node_modules/undici/lib/web/fileapi/encoding.js +290 -0
- package/node_modules/undici/lib/web/fileapi/filereader.js +344 -0
- package/node_modules/undici/lib/web/fileapi/progressevent.js +78 -0
- package/node_modules/undici/lib/web/fileapi/symbols.js +10 -0
- package/node_modules/undici/lib/web/fileapi/util.js +391 -0
- package/node_modules/undici/lib/web/websocket/connection.js +160 -139
- package/node_modules/undici/lib/web/websocket/constants.js +10 -70
- package/node_modules/undici/lib/web/websocket/events.js +30 -49
- package/node_modules/undici/lib/web/websocket/frame.js +20 -51
- package/node_modules/undici/lib/web/websocket/receiver.js +87 -83
- package/node_modules/undici/lib/web/websocket/sender.js +13 -18
- package/node_modules/undici/lib/web/websocket/symbols.js +12 -0
- package/node_modules/undici/lib/web/websocket/util.js +90 -115
- package/node_modules/undici/lib/web/websocket/websocket.js +171 -359
- package/node_modules/undici/package.json +57 -49
- package/node_modules/undici/scripts/strip-comments.js +1 -3
- package/node_modules/undici/types/agent.d.ts +13 -12
- package/node_modules/undici/types/api.d.ts +26 -26
- package/node_modules/undici/types/balanced-pool.d.ts +12 -13
- package/node_modules/undici/types/client.d.ts +39 -98
- package/node_modules/undici/types/connector.d.ts +2 -5
- package/node_modules/undici/types/cookies.d.ts +1 -3
- package/node_modules/undici/types/diagnostics-channel.d.ts +11 -20
- package/node_modules/undici/types/dispatcher.d.ts +139 -136
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici/types/errors.d.ts +54 -86
- package/node_modules/undici/types/eventsource.d.ts +4 -9
- package/node_modules/undici/types/fetch.d.ts +25 -51
- package/node_modules/undici/types/file.d.ts +39 -0
- package/node_modules/undici/types/filereader.d.ts +54 -0
- package/node_modules/undici/types/formdata.d.ts +7 -7
- package/node_modules/undici/types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici/types/global-origin.d.ts +5 -5
- package/node_modules/undici/types/handlers.d.ts +9 -10
- package/node_modules/undici/types/header.d.ts +1 -162
- package/node_modules/undici/types/index.d.ts +47 -69
- package/node_modules/undici/types/interceptors.d.ts +12 -62
- package/node_modules/undici/types/mock-agent.d.ts +27 -46
- package/node_modules/undici/types/mock-client.d.ts +4 -6
- package/node_modules/undici/types/mock-errors.d.ts +3 -3
- package/node_modules/undici/types/mock-interceptor.d.ts +21 -26
- package/node_modules/undici/types/mock-pool.d.ts +4 -6
- package/node_modules/undici/types/patch.d.ts +4 -0
- package/node_modules/undici/types/pool-stats.d.ts +8 -8
- package/node_modules/undici/types/pool.d.ts +14 -14
- package/node_modules/undici/types/proxy-agent.d.ts +6 -13
- package/node_modules/undici/types/readable.d.ts +16 -19
- package/node_modules/undici/types/retry-agent.d.ts +1 -1
- package/node_modules/undici/types/retry-handler.d.ts +9 -18
- package/node_modules/undici/types/util.d.ts +3 -3
- package/node_modules/undici/types/webidl.d.ts +32 -156
- package/node_modules/undici/types/websocket.d.ts +10 -48
- package/node_modules/validate-npm-package-name/package.json +4 -4
- package/node_modules/which/package.json +4 -4
- package/node_modules/write-file-atomic/package.json +4 -4
- package/package.json +56 -60
- package/node_modules/@npmcli/arborist/lib/npm-extension.js +0 -237
- package/node_modules/@npmcli/arborist/lib/package-extensions.js +0 -236
- package/node_modules/@npmcli/arborist/lib/patch.js +0 -111
- package/node_modules/@npmcli/arborist/lib/patched-dependencies.js +0 -168
- package/node_modules/cacache/lib/util/cache-dir.js +0 -29
- package/node_modules/diff/CONTRIBUTING.md +0 -28
- package/node_modules/diff/LICENSE +0 -29
- package/node_modules/diff/README.md +0 -388
- package/node_modules/diff/dist/diff.js +0 -1782
- package/node_modules/diff/dist/diff.min.js +0 -1
- package/node_modules/diff/eslint.config.mjs +0 -182
- package/node_modules/diff/libcjs/convert/dmp.d.ts +0 -8
- package/node_modules/diff/libcjs/convert/dmp.d.ts.map +0 -1
- package/node_modules/diff/libcjs/convert/dmp.js +0 -24
- package/node_modules/diff/libcjs/convert/xml.d.ts +0 -6
- package/node_modules/diff/libcjs/convert/xml.d.ts.map +0 -1
- package/node_modules/diff/libcjs/convert/xml.js +0 -34
- package/node_modules/diff/libcjs/diff/array.d.ts +0 -19
- package/node_modules/diff/libcjs/diff/array.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/array.js +0 -40
- package/node_modules/diff/libcjs/diff/base.d.ts +0 -20
- package/node_modules/diff/libcjs/diff/base.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/base.js +0 -265
- package/node_modules/diff/libcjs/diff/character.d.ts +0 -19
- package/node_modules/diff/libcjs/diff/character.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/character.js +0 -31
- package/node_modules/diff/libcjs/diff/css.d.ts +0 -18
- package/node_modules/diff/libcjs/diff/css.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/css.js +0 -34
- package/node_modules/diff/libcjs/diff/json.d.ts +0 -24
- package/node_modules/diff/libcjs/diff/json.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/json.js +0 -105
- package/node_modules/diff/libcjs/diff/line.d.ts +0 -24
- package/node_modules/diff/libcjs/diff/line.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/line.js +0 -89
- package/node_modules/diff/libcjs/diff/sentence.d.ts +0 -21
- package/node_modules/diff/libcjs/diff/sentence.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/sentence.js +0 -67
- package/node_modules/diff/libcjs/diff/word.d.ts +0 -35
- package/node_modules/diff/libcjs/diff/word.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/word.js +0 -312
- package/node_modules/diff/libcjs/index.d.ts +0 -20
- package/node_modules/diff/libcjs/index.d.ts.map +0 -1
- package/node_modules/diff/libcjs/index.js +0 -64
- package/node_modules/diff/libcjs/package.json +0 -1
- package/node_modules/diff/libcjs/patch/apply.d.ts +0 -62
- package/node_modules/diff/libcjs/patch/apply.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/apply.js +0 -267
- package/node_modules/diff/libcjs/patch/create.d.ts +0 -122
- package/node_modules/diff/libcjs/patch/create.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/create.js +0 -251
- package/node_modules/diff/libcjs/patch/line-endings.d.ts +0 -17
- package/node_modules/diff/libcjs/patch/line-endings.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/line-endings.js +0 -61
- package/node_modules/diff/libcjs/patch/parse.d.ts +0 -8
- package/node_modules/diff/libcjs/patch/parse.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/parse.js +0 -150
- package/node_modules/diff/libcjs/patch/reverse.d.ts +0 -9
- package/node_modules/diff/libcjs/patch/reverse.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/reverse.js +0 -37
- package/node_modules/diff/libcjs/types.d.ts +0 -213
- package/node_modules/diff/libcjs/types.d.ts.map +0 -1
- package/node_modules/diff/libcjs/types.js +0 -2
- package/node_modules/diff/libcjs/util/array.d.ts +0 -3
- package/node_modules/diff/libcjs/util/array.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/array.js +0 -21
- package/node_modules/diff/libcjs/util/distance-iterator.d.ts +0 -2
- package/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/distance-iterator.js +0 -40
- package/node_modules/diff/libcjs/util/params.d.ts +0 -4
- package/node_modules/diff/libcjs/util/params.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/params.js +0 -17
- package/node_modules/diff/libcjs/util/string.d.ts +0 -30
- package/node_modules/diff/libcjs/util/string.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/string.js +0 -200
- package/node_modules/diff/libesm/convert/dmp.d.ts +0 -8
- package/node_modules/diff/libesm/convert/dmp.d.ts.map +0 -1
- package/node_modules/diff/libesm/convert/dmp.js +0 -21
- package/node_modules/diff/libesm/convert/xml.d.ts +0 -6
- package/node_modules/diff/libesm/convert/xml.d.ts.map +0 -1
- package/node_modules/diff/libesm/convert/xml.js +0 -31
- package/node_modules/diff/libesm/diff/array.d.ts +0 -19
- package/node_modules/diff/libesm/diff/array.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/array.js +0 -16
- package/node_modules/diff/libesm/diff/base.d.ts +0 -20
- package/node_modules/diff/libesm/diff/base.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/base.js +0 -253
- package/node_modules/diff/libesm/diff/character.d.ts +0 -19
- package/node_modules/diff/libesm/diff/character.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/character.js +0 -7
- package/node_modules/diff/libesm/diff/css.d.ts +0 -18
- package/node_modules/diff/libesm/diff/css.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/css.js +0 -10
- package/node_modules/diff/libesm/diff/json.d.ts +0 -24
- package/node_modules/diff/libesm/diff/json.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/json.js +0 -78
- package/node_modules/diff/libesm/diff/line.d.ts +0 -24
- package/node_modules/diff/libesm/diff/line.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/line.js +0 -65
- package/node_modules/diff/libesm/diff/sentence.d.ts +0 -21
- package/node_modules/diff/libesm/diff/sentence.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/sentence.js +0 -43
- package/node_modules/diff/libesm/diff/word.d.ts +0 -35
- package/node_modules/diff/libesm/diff/word.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/word.js +0 -281
- package/node_modules/diff/libesm/index.d.ts +0 -20
- package/node_modules/diff/libesm/index.d.ts.map +0 -1
- package/node_modules/diff/libesm/index.js +0 -30
- package/node_modules/diff/libesm/package.json +0 -1
- package/node_modules/diff/libesm/patch/apply.d.ts +0 -62
- package/node_modules/diff/libesm/patch/apply.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/apply.js +0 -257
- package/node_modules/diff/libesm/patch/create.d.ts +0 -122
- package/node_modules/diff/libesm/patch/create.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/create.js +0 -228
- package/node_modules/diff/libesm/patch/line-endings.d.ts +0 -17
- package/node_modules/diff/libesm/patch/line-endings.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/line-endings.js +0 -44
- package/node_modules/diff/libesm/patch/parse.d.ts +0 -8
- package/node_modules/diff/libesm/patch/parse.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/parse.js +0 -147
- package/node_modules/diff/libesm/patch/reverse.d.ts +0 -9
- package/node_modules/diff/libesm/patch/reverse.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/reverse.js +0 -23
- package/node_modules/diff/libesm/types.d.ts +0 -213
- package/node_modules/diff/libesm/types.d.ts.map +0 -1
- package/node_modules/diff/libesm/types.js +0 -1
- package/node_modules/diff/libesm/util/array.d.ts +0 -3
- package/node_modules/diff/libesm/util/array.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/array.js +0 -17
- package/node_modules/diff/libesm/util/distance-iterator.d.ts +0 -2
- package/node_modules/diff/libesm/util/distance-iterator.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/distance-iterator.js +0 -37
- package/node_modules/diff/libesm/util/params.d.ts +0 -4
- package/node_modules/diff/libesm/util/params.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/params.js +0 -14
- package/node_modules/diff/libesm/util/string.d.ts +0 -30
- package/node_modules/diff/libesm/util/string.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/string.js +0 -184
- package/node_modules/diff/package.json +0 -130
- package/node_modules/diff/release-notes.md +0 -432
- package/node_modules/node-gyp/commitlint.config.mjs +0 -3
- package/node_modules/node-gyp/gyp/commitlint.config.js +0 -6
- package/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake_test.py +0 -105
- package/node_modules/node-gyp/zizmor.yml +0 -5
- package/node_modules/proxy-agent-negotiate/dist/index.d.ts +0 -14
- package/node_modules/proxy-agent-negotiate/dist/index.d.ts.map +0 -1
- package/node_modules/proxy-agent-negotiate/dist/index.js +0 -35
- package/node_modules/proxy-agent-negotiate/dist/index.js.map +0 -1
- package/node_modules/proxy-agent-negotiate/package.json +0 -47
- package/node_modules/undici/docs/docs/api/CacheStore.md +0 -360
- package/node_modules/undici/docs/docs/api/ClientStats.md +0 -93
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +0 -121
- package/node_modules/undici/docs/docs/api/H2CClient.md +0 -385
- package/node_modules/undici/docs/docs/api/Interceptors.md +0 -419
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +0 -371
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +0 -206
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +0 -239
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +0 -361
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +0 -256
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +0 -233
- package/node_modules/undici/docs/docs/getting-started.md +0 -281
- package/node_modules/undici/docs/docs/site.json +0 -125
- package/node_modules/undici/docs/docs/type-map.json +0 -79
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +0 -110
- package/node_modules/undici/types/dispatcher1-wrapper.d.ts +0 -7
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/core/socks5-client.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/core/socks5-utils.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/encoding/index.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/llhttp/constants.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/llhttp/utils.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/snapshot-utils.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/date.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/stats.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/subresource-integrity/Readme.md +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/subresource-integrity/subresource-integrity.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/cache-interceptor.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/client-stats.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/mock-call-history.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/utility.d.ts +0 -0
|
@@ -50,156 +50,90 @@ const {
|
|
|
50
50
|
kMaxResponseSize,
|
|
51
51
|
kOnError,
|
|
52
52
|
kResume,
|
|
53
|
-
kHTTPContext
|
|
54
|
-
kClosed
|
|
53
|
+
kHTTPContext
|
|
55
54
|
} = require('../core/symbols.js')
|
|
56
55
|
|
|
57
56
|
const constants = require('../llhttp/constants.js')
|
|
58
57
|
const EMPTY_BUF = Buffer.alloc(0)
|
|
59
58
|
const FastBuffer = Buffer[Symbol.species]
|
|
59
|
+
const addListener = util.addListener
|
|
60
60
|
const removeAllListeners = util.removeAllListeners
|
|
61
61
|
const kIdleSocketValidation = Symbol('kIdleSocketValidation')
|
|
62
62
|
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
|
|
63
63
|
const kSocketUsed = Symbol('kSocketUsed')
|
|
64
|
-
const kTypeOfService = Symbol('kTypeOfService')
|
|
65
64
|
|
|
66
65
|
let extractBody
|
|
67
66
|
|
|
68
|
-
function lazyllhttp () {
|
|
67
|
+
async function lazyllhttp () {
|
|
69
68
|
const llhttpWasmData = process.env.JEST_WORKER_ID ? require('../llhttp/llhttp-wasm.js') : undefined
|
|
70
69
|
|
|
71
70
|
let mod
|
|
71
|
+
try {
|
|
72
|
+
mod = await WebAssembly.compile(require('../llhttp/llhttp_simd-wasm.js'))
|
|
73
|
+
} catch (e) {
|
|
74
|
+
/* istanbul ignore next */
|
|
72
75
|
|
|
73
|
-
// We disable wasm SIMD on older versions of Node.js on ppc64 that are broken on Power >=9 architectures.
|
|
74
|
-
let useWasmSIMD = true
|
|
75
|
-
if (process.arch === 'ppc64') {
|
|
76
|
-
const [major, minor] = process.versions.node.split('.').map(n => parseInt(n, 10))
|
|
77
|
-
if (major < 24 || (major === 24 && minor < 12)) {
|
|
78
|
-
useWasmSIMD = false
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// The Env Variable UNDICI_NO_WASM_SIMD allows explicitly overriding the default behavior
|
|
82
|
-
if (process.env.UNDICI_NO_WASM_SIMD === '1') {
|
|
83
|
-
useWasmSIMD = false
|
|
84
|
-
} else if (process.env.UNDICI_NO_WASM_SIMD === '0') {
|
|
85
|
-
useWasmSIMD = true
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (useWasmSIMD) {
|
|
89
|
-
try {
|
|
90
|
-
mod = new WebAssembly.Module(require('../llhttp/llhttp_simd-wasm.js'))
|
|
91
|
-
} catch {
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (!mod) {
|
|
96
76
|
// We could check if the error was caused by the simd option not
|
|
97
77
|
// being enabled, but the occurring of this other error
|
|
98
78
|
// * https://github.com/emscripten-core/emscripten/issues/11495
|
|
99
79
|
// got me to remove that check to avoid breaking Node 12.
|
|
100
|
-
mod =
|
|
80
|
+
mod = await WebAssembly.compile(llhttpWasmData || require('../llhttp/llhttp-wasm.js'))
|
|
101
81
|
}
|
|
102
82
|
|
|
103
|
-
return
|
|
83
|
+
return await WebAssembly.instantiate(mod, {
|
|
104
84
|
env: {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* @param {number} at
|
|
108
|
-
* @param {number} len
|
|
109
|
-
* @returns {number}
|
|
110
|
-
*/
|
|
85
|
+
/* eslint-disable camelcase */
|
|
86
|
+
|
|
111
87
|
wasm_on_url: (p, at, len) => {
|
|
88
|
+
/* istanbul ignore next */
|
|
112
89
|
return 0
|
|
113
90
|
},
|
|
114
|
-
/**
|
|
115
|
-
* @param {number} p
|
|
116
|
-
* @param {number} at
|
|
117
|
-
* @param {number} len
|
|
118
|
-
* @returns {number}
|
|
119
|
-
*/
|
|
120
91
|
wasm_on_status: (p, at, len) => {
|
|
121
92
|
assert(currentParser.ptr === p)
|
|
122
93
|
const start = at - currentBufferPtr + currentBufferRef.byteOffset
|
|
123
|
-
return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len))
|
|
94
|
+
return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
|
|
124
95
|
},
|
|
125
|
-
/**
|
|
126
|
-
* @param {number} p
|
|
127
|
-
* @returns {number}
|
|
128
|
-
*/
|
|
129
96
|
wasm_on_message_begin: (p) => {
|
|
130
97
|
assert(currentParser.ptr === p)
|
|
131
|
-
return currentParser.onMessageBegin()
|
|
98
|
+
return currentParser.onMessageBegin() || 0
|
|
132
99
|
},
|
|
133
|
-
/**
|
|
134
|
-
* @param {number} p
|
|
135
|
-
* @param {number} at
|
|
136
|
-
* @param {number} len
|
|
137
|
-
* @returns {number}
|
|
138
|
-
*/
|
|
139
100
|
wasm_on_header_field: (p, at, len) => {
|
|
140
101
|
assert(currentParser.ptr === p)
|
|
141
102
|
const start = at - currentBufferPtr + currentBufferRef.byteOffset
|
|
142
|
-
return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len))
|
|
103
|
+
return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
|
|
143
104
|
},
|
|
144
|
-
/**
|
|
145
|
-
* @param {number} p
|
|
146
|
-
* @param {number} at
|
|
147
|
-
* @param {number} len
|
|
148
|
-
* @returns {number}
|
|
149
|
-
*/
|
|
150
105
|
wasm_on_header_value: (p, at, len) => {
|
|
151
106
|
assert(currentParser.ptr === p)
|
|
152
107
|
const start = at - currentBufferPtr + currentBufferRef.byteOffset
|
|
153
|
-
return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len))
|
|
108
|
+
return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
|
|
154
109
|
},
|
|
155
|
-
/**
|
|
156
|
-
* @param {number} p
|
|
157
|
-
* @param {number} statusCode
|
|
158
|
-
* @param {0|1} upgrade
|
|
159
|
-
* @param {0|1} shouldKeepAlive
|
|
160
|
-
* @returns {number}
|
|
161
|
-
*/
|
|
162
110
|
wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => {
|
|
163
111
|
assert(currentParser.ptr === p)
|
|
164
|
-
return currentParser.onHeadersComplete(statusCode, upgrade
|
|
112
|
+
return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0
|
|
165
113
|
},
|
|
166
|
-
/**
|
|
167
|
-
* @param {number} p
|
|
168
|
-
* @param {number} at
|
|
169
|
-
* @param {number} len
|
|
170
|
-
* @returns {number}
|
|
171
|
-
*/
|
|
172
114
|
wasm_on_body: (p, at, len) => {
|
|
173
115
|
assert(currentParser.ptr === p)
|
|
174
116
|
const start = at - currentBufferPtr + currentBufferRef.byteOffset
|
|
175
|
-
return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len))
|
|
117
|
+
return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
|
|
176
118
|
},
|
|
177
|
-
/**
|
|
178
|
-
* @param {number} p
|
|
179
|
-
* @returns {number}
|
|
180
|
-
*/
|
|
181
119
|
wasm_on_message_complete: (p) => {
|
|
182
120
|
assert(currentParser.ptr === p)
|
|
183
|
-
return currentParser.onMessageComplete()
|
|
121
|
+
return currentParser.onMessageComplete() || 0
|
|
184
122
|
}
|
|
185
123
|
|
|
124
|
+
/* eslint-enable camelcase */
|
|
186
125
|
}
|
|
187
126
|
})
|
|
188
127
|
}
|
|
189
128
|
|
|
190
129
|
let llhttpInstance = null
|
|
130
|
+
let llhttpPromise = lazyllhttp()
|
|
131
|
+
llhttpPromise.catch()
|
|
191
132
|
|
|
192
|
-
/**
|
|
193
|
-
* @type {Parser|null}
|
|
194
|
-
*/
|
|
195
133
|
let currentParser = null
|
|
196
134
|
let currentBufferRef = null
|
|
197
|
-
/**
|
|
198
|
-
* @type {number}
|
|
199
|
-
*/
|
|
200
135
|
let currentBufferSize = 0
|
|
201
136
|
let currentBufferPtr = null
|
|
202
|
-
let currentBuffer = null
|
|
203
137
|
|
|
204
138
|
const USE_NATIVE_TIMER = 0
|
|
205
139
|
const USE_FAST_TIMER = 1
|
|
@@ -214,24 +148,17 @@ const TIMEOUT_BODY = 4 | USE_FAST_TIMER
|
|
|
214
148
|
const TIMEOUT_KEEP_ALIVE = 8 | USE_NATIVE_TIMER
|
|
215
149
|
|
|
216
150
|
class Parser {
|
|
217
|
-
/**
|
|
218
|
-
* @param {import('./client.js')} client
|
|
219
|
-
* @param {import('net').Socket} socket
|
|
220
|
-
* @param {*} llhttp
|
|
221
|
-
*/
|
|
222
151
|
constructor (client, socket, { exports }) {
|
|
152
|
+
assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0)
|
|
153
|
+
|
|
223
154
|
this.llhttp = exports
|
|
224
155
|
this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE)
|
|
225
156
|
this.client = client
|
|
226
|
-
/**
|
|
227
|
-
* @type {import('net').Socket}
|
|
228
|
-
*/
|
|
229
157
|
this.socket = socket
|
|
230
158
|
this.timeout = null
|
|
231
|
-
this.timeoutWeakRef = new WeakRef(this)
|
|
232
159
|
this.timeoutValue = null
|
|
233
160
|
this.timeoutType = null
|
|
234
|
-
this.statusCode =
|
|
161
|
+
this.statusCode = null
|
|
235
162
|
this.statusText = ''
|
|
236
163
|
this.upgrade = false
|
|
237
164
|
this.headers = []
|
|
@@ -244,8 +171,8 @@ class Parser {
|
|
|
244
171
|
this.bytesRead = 0
|
|
245
172
|
|
|
246
173
|
this.keepAlive = ''
|
|
247
|
-
this.contentLength =
|
|
248
|
-
this.
|
|
174
|
+
this.contentLength = ''
|
|
175
|
+
this.connection = ''
|
|
249
176
|
this.maxResponseSize = client[kMaxResponseSize]
|
|
250
177
|
}
|
|
251
178
|
|
|
@@ -266,15 +193,16 @@ class Parser {
|
|
|
266
193
|
|
|
267
194
|
if (delay) {
|
|
268
195
|
if (type & USE_FAST_TIMER) {
|
|
269
|
-
this.timeout = timers.setFastTimeout(onParserTimeout, delay, this
|
|
196
|
+
this.timeout = timers.setFastTimeout(onParserTimeout, delay, new WeakRef(this))
|
|
270
197
|
} else {
|
|
271
|
-
this.timeout = setTimeout(onParserTimeout, delay, this
|
|
272
|
-
this.timeout
|
|
198
|
+
this.timeout = setTimeout(onParserTimeout, delay, new WeakRef(this))
|
|
199
|
+
this.timeout.unref()
|
|
273
200
|
}
|
|
274
201
|
}
|
|
275
202
|
|
|
276
203
|
this.timeoutValue = delay
|
|
277
204
|
} else if (this.timeout) {
|
|
205
|
+
// istanbul ignore else: only for jest
|
|
278
206
|
if (this.timeout.refresh) {
|
|
279
207
|
this.timeout.refresh()
|
|
280
208
|
}
|
|
@@ -289,12 +217,13 @@ class Parser {
|
|
|
289
217
|
}
|
|
290
218
|
|
|
291
219
|
assert(this.ptr != null)
|
|
292
|
-
assert(currentParser
|
|
220
|
+
assert(currentParser == null)
|
|
293
221
|
|
|
294
222
|
this.llhttp.llhttp_resume(this.ptr)
|
|
295
223
|
|
|
296
224
|
assert(this.timeoutType === TIMEOUT_BODY)
|
|
297
225
|
if (this.timeout) {
|
|
226
|
+
// istanbul ignore else: only for jest
|
|
298
227
|
if (this.timeout.refresh) {
|
|
299
228
|
this.timeout.refresh()
|
|
300
229
|
}
|
|
@@ -315,36 +244,22 @@ class Parser {
|
|
|
315
244
|
}
|
|
316
245
|
}
|
|
317
246
|
|
|
318
|
-
|
|
319
|
-
* @param {Buffer} chunk
|
|
320
|
-
*/
|
|
321
|
-
execute (chunk) {
|
|
322
|
-
assert(currentParser === null)
|
|
247
|
+
execute (data) {
|
|
323
248
|
assert(this.ptr != null)
|
|
249
|
+
assert(currentParser == null)
|
|
324
250
|
assert(!this.paused)
|
|
325
251
|
|
|
326
252
|
const { socket, llhttp } = this
|
|
327
253
|
|
|
328
|
-
|
|
329
|
-
if (chunk.length > currentBufferSize) {
|
|
254
|
+
if (data.length > currentBufferSize) {
|
|
330
255
|
if (currentBufferPtr) {
|
|
331
256
|
llhttp.free(currentBufferPtr)
|
|
332
257
|
}
|
|
333
|
-
|
|
334
|
-
currentBufferSize = Math.ceil(chunk.length / 4096) * 4096
|
|
258
|
+
currentBufferSize = Math.ceil(data.length / 4096) * 4096
|
|
335
259
|
currentBufferPtr = llhttp.malloc(currentBufferSize)
|
|
336
260
|
}
|
|
337
261
|
|
|
338
|
-
|
|
339
|
-
currentBuffer === null ||
|
|
340
|
-
currentBuffer.buffer !== llhttp.memory.buffer ||
|
|
341
|
-
currentBuffer.byteOffset !== currentBufferPtr ||
|
|
342
|
-
currentBuffer.byteLength !== currentBufferSize
|
|
343
|
-
) {
|
|
344
|
-
currentBuffer = new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize)
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
currentBuffer.set(chunk)
|
|
262
|
+
new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data)
|
|
348
263
|
|
|
349
264
|
// Call `execute` on the wasm parser.
|
|
350
265
|
// We pass the `llhttp_parser` pointer address, the pointer address of buffer view data,
|
|
@@ -354,24 +269,30 @@ class Parser {
|
|
|
354
269
|
let ret
|
|
355
270
|
|
|
356
271
|
try {
|
|
357
|
-
currentBufferRef =
|
|
272
|
+
currentBufferRef = data
|
|
358
273
|
currentParser = this
|
|
359
|
-
ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr,
|
|
274
|
+
ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length)
|
|
275
|
+
/* eslint-disable-next-line no-useless-catch */
|
|
276
|
+
} catch (err) {
|
|
277
|
+
/* istanbul ignore next: difficult to make a test case for */
|
|
278
|
+
throw err
|
|
360
279
|
} finally {
|
|
361
280
|
currentParser = null
|
|
362
281
|
currentBufferRef = null
|
|
363
282
|
}
|
|
364
283
|
|
|
284
|
+
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
|
|
285
|
+
|
|
365
286
|
if (ret !== constants.ERROR.OK) {
|
|
366
|
-
const
|
|
287
|
+
const body = data.subarray(offset)
|
|
367
288
|
|
|
368
289
|
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
|
369
|
-
this.onUpgrade(
|
|
290
|
+
this.onUpgrade(body)
|
|
370
291
|
} else if (ret === constants.ERROR.PAUSED) {
|
|
371
292
|
this.paused = true
|
|
372
|
-
socket.unshift(
|
|
293
|
+
socket.unshift(body)
|
|
373
294
|
} else {
|
|
374
|
-
throw this.createError(ret,
|
|
295
|
+
throw this.createError(ret, body)
|
|
375
296
|
}
|
|
376
297
|
}
|
|
377
298
|
} catch (err) {
|
|
@@ -382,32 +303,10 @@ class Parser {
|
|
|
382
303
|
finish () {
|
|
383
304
|
assert(currentParser === null)
|
|
384
305
|
assert(this.ptr != null)
|
|
306
|
+
assert(!this.paused)
|
|
385
307
|
|
|
386
308
|
const { llhttp } = this
|
|
387
309
|
|
|
388
|
-
// The peer closed the connection. If the body parser was paused by
|
|
389
|
-
// backpressure we must finish parsing before signalling EOF, otherwise
|
|
390
|
-
// llhttp_finish() would crash (it used to assert !paused) or report a
|
|
391
|
-
// half-parsed message. Backpressure is advisory here: onData keeps buffering
|
|
392
|
-
// delivered bytes into the response stream, so resume across pauses and
|
|
393
|
-
// drain whatever is still buffered on the socket. A Content-Length/chunked
|
|
394
|
-
// body reaches on_message_complete during execute(); an EOF-delimited body
|
|
395
|
-
// stays paused (its length is unknown) and is completed by llhttp_finish().
|
|
396
|
-
if (this.paused) {
|
|
397
|
-
let data
|
|
398
|
-
do {
|
|
399
|
-
llhttp.llhttp_resume(this.ptr)
|
|
400
|
-
this.paused = false
|
|
401
|
-
data = this.socket.read() || EMPTY_BUF
|
|
402
|
-
this.execute(data)
|
|
403
|
-
} while (this.paused && data.length > 0)
|
|
404
|
-
|
|
405
|
-
if (this.paused) {
|
|
406
|
-
llhttp.llhttp_resume(this.ptr)
|
|
407
|
-
this.paused = false
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
310
|
let ret
|
|
412
311
|
|
|
413
312
|
try {
|
|
@@ -432,7 +331,7 @@ class Parser {
|
|
|
432
331
|
createError (ret, data) {
|
|
433
332
|
const { llhttp, contentLength, bytesRead } = this
|
|
434
333
|
|
|
435
|
-
if (contentLength
|
|
334
|
+
if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
|
436
335
|
return new ResponseContentLengthMismatchError()
|
|
437
336
|
}
|
|
438
337
|
|
|
@@ -450,8 +349,8 @@ class Parser {
|
|
|
450
349
|
}
|
|
451
350
|
|
|
452
351
|
destroy () {
|
|
453
|
-
assert(currentParser === null)
|
|
454
352
|
assert(this.ptr != null)
|
|
353
|
+
assert(currentParser == null)
|
|
455
354
|
|
|
456
355
|
this.llhttp.llhttp_free(this.ptr)
|
|
457
356
|
this.ptr = null
|
|
@@ -464,21 +363,14 @@ class Parser {
|
|
|
464
363
|
this.paused = false
|
|
465
364
|
}
|
|
466
365
|
|
|
467
|
-
/**
|
|
468
|
-
* @param {Buffer} buf
|
|
469
|
-
* @returns {0}
|
|
470
|
-
*/
|
|
471
366
|
onStatus (buf) {
|
|
472
367
|
this.statusText = buf.toString()
|
|
473
|
-
return 0
|
|
474
368
|
}
|
|
475
369
|
|
|
476
|
-
/**
|
|
477
|
-
* @returns {0|-1}
|
|
478
|
-
*/
|
|
479
370
|
onMessageBegin () {
|
|
480
371
|
const { socket, client } = this
|
|
481
372
|
|
|
373
|
+
/* istanbul ignore next: difficult to make a test case for */
|
|
482
374
|
if (socket.destroyed) {
|
|
483
375
|
return -1
|
|
484
376
|
}
|
|
@@ -493,14 +385,8 @@ class Parser {
|
|
|
493
385
|
return -1
|
|
494
386
|
}
|
|
495
387
|
request.onResponseStarted()
|
|
496
|
-
|
|
497
|
-
return 0
|
|
498
388
|
}
|
|
499
389
|
|
|
500
|
-
/**
|
|
501
|
-
* @param {Buffer} buf
|
|
502
|
-
* @returns {number}
|
|
503
|
-
*/
|
|
504
390
|
onHeaderField (buf) {
|
|
505
391
|
const len = this.headers.length
|
|
506
392
|
|
|
@@ -511,14 +397,8 @@ class Parser {
|
|
|
511
397
|
}
|
|
512
398
|
|
|
513
399
|
this.trackHeader(buf.length)
|
|
514
|
-
|
|
515
|
-
return 0
|
|
516
400
|
}
|
|
517
401
|
|
|
518
|
-
/**
|
|
519
|
-
* @param {Buffer} buf
|
|
520
|
-
* @returns {number}
|
|
521
|
-
*/
|
|
522
402
|
onHeaderValue (buf) {
|
|
523
403
|
let len = this.headers.length
|
|
524
404
|
|
|
@@ -535,27 +415,15 @@ class Parser {
|
|
|
535
415
|
if (headerName === 'keep-alive') {
|
|
536
416
|
this.keepAlive += buf.toString()
|
|
537
417
|
} else if (headerName === 'connection') {
|
|
538
|
-
this.
|
|
539
|
-
this.headers[len - 1].length === 10 &&
|
|
540
|
-
util.bufferToLowerCasedHeaderName(this.headers[len - 1]) === 'keep-alive'
|
|
418
|
+
this.connection += buf.toString()
|
|
541
419
|
}
|
|
542
420
|
} else if (key.length === 14 && util.bufferToLowerCasedHeaderName(key) === 'content-length') {
|
|
543
|
-
|
|
544
|
-
this.contentLength = 0
|
|
545
|
-
}
|
|
546
|
-
for (let i = 0; i < buf.length; i++) {
|
|
547
|
-
this.contentLength = (this.contentLength * 10) + (buf[i] - 0x30)
|
|
548
|
-
}
|
|
421
|
+
this.contentLength += buf.toString()
|
|
549
422
|
}
|
|
550
423
|
|
|
551
424
|
this.trackHeader(buf.length)
|
|
552
|
-
|
|
553
|
-
return 0
|
|
554
425
|
}
|
|
555
426
|
|
|
556
|
-
/**
|
|
557
|
-
* @param {number} len
|
|
558
|
-
*/
|
|
559
427
|
trackHeader (len) {
|
|
560
428
|
this.headersSize += len
|
|
561
429
|
if (this.headersSize >= this.headersMaxSize) {
|
|
@@ -563,9 +431,6 @@ class Parser {
|
|
|
563
431
|
}
|
|
564
432
|
}
|
|
565
433
|
|
|
566
|
-
/**
|
|
567
|
-
* @param {Buffer} head
|
|
568
|
-
*/
|
|
569
434
|
onUpgrade (head) {
|
|
570
435
|
const { upgrade, client, socket, headers, statusCode, statusText } = this
|
|
571
436
|
|
|
@@ -579,9 +444,9 @@ class Parser {
|
|
|
579
444
|
assert(request)
|
|
580
445
|
assert(request.upgrade || request.method === 'CONNECT')
|
|
581
446
|
|
|
582
|
-
this.statusCode =
|
|
447
|
+
this.statusCode = null
|
|
583
448
|
this.statusText = ''
|
|
584
|
-
this.shouldKeepAlive =
|
|
449
|
+
this.shouldKeepAlive = null
|
|
585
450
|
|
|
586
451
|
this.headers = []
|
|
587
452
|
this.headersSize = 0
|
|
@@ -602,24 +467,19 @@ class Parser {
|
|
|
602
467
|
client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade'))
|
|
603
468
|
|
|
604
469
|
try {
|
|
605
|
-
request.
|
|
606
|
-
} catch (
|
|
607
|
-
util.errorRequest(client, request,
|
|
608
|
-
util.destroy(socket,
|
|
470
|
+
request.onUpgrade(statusCode, headers, socket, statusText)
|
|
471
|
+
} catch (error) {
|
|
472
|
+
util.errorRequest(client, request, error)
|
|
473
|
+
util.destroy(socket, error)
|
|
609
474
|
}
|
|
610
475
|
|
|
611
476
|
client[kResume]()
|
|
612
477
|
}
|
|
613
478
|
|
|
614
|
-
/**
|
|
615
|
-
* @param {number} statusCode
|
|
616
|
-
* @param {boolean} upgrade
|
|
617
|
-
* @param {boolean} shouldKeepAlive
|
|
618
|
-
* @returns {number}
|
|
619
|
-
*/
|
|
620
479
|
onHeadersComplete (statusCode, upgrade, shouldKeepAlive) {
|
|
621
480
|
const { client, socket, headers, statusText } = this
|
|
622
481
|
|
|
482
|
+
/* istanbul ignore next: difficult to make a test case for */
|
|
623
483
|
if (socket.destroyed) {
|
|
624
484
|
return -1
|
|
625
485
|
}
|
|
@@ -631,6 +491,7 @@ class Parser {
|
|
|
631
491
|
|
|
632
492
|
const request = client[kQueue][client[kRunningIdx]]
|
|
633
493
|
|
|
494
|
+
/* istanbul ignore next: difficult to make a test case for */
|
|
634
495
|
if (!request) {
|
|
635
496
|
return -1
|
|
636
497
|
}
|
|
@@ -655,7 +516,7 @@ class Parser {
|
|
|
655
516
|
this.shouldKeepAlive = (
|
|
656
517
|
shouldKeepAlive ||
|
|
657
518
|
// Override llhttp value which does not allow keepAlive for HEAD.
|
|
658
|
-
(request.method === 'HEAD' && !socket[kReset] && this.
|
|
519
|
+
(request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
|
|
659
520
|
)
|
|
660
521
|
|
|
661
522
|
if (this.statusCode >= 200) {
|
|
@@ -664,6 +525,7 @@ class Parser {
|
|
|
664
525
|
: client[kBodyTimeout]
|
|
665
526
|
this.setTimeout(bodyTimeout, TIMEOUT_BODY)
|
|
666
527
|
} else if (this.timeout) {
|
|
528
|
+
// istanbul ignore else: only for jest
|
|
667
529
|
if (this.timeout.refresh) {
|
|
668
530
|
this.timeout.refresh()
|
|
669
531
|
}
|
|
@@ -706,7 +568,7 @@ class Parser {
|
|
|
706
568
|
socket[kReset] = true
|
|
707
569
|
}
|
|
708
570
|
|
|
709
|
-
const pause = request.
|
|
571
|
+
const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
|
|
710
572
|
|
|
711
573
|
if (request.aborted) {
|
|
712
574
|
return -1
|
|
@@ -728,10 +590,6 @@ class Parser {
|
|
|
728
590
|
return pause ? constants.ERROR.PAUSED : 0
|
|
729
591
|
}
|
|
730
592
|
|
|
731
|
-
/**
|
|
732
|
-
* @param {Buffer} buf
|
|
733
|
-
* @returns {number}
|
|
734
|
-
*/
|
|
735
593
|
onBody (buf) {
|
|
736
594
|
const { client, socket, statusCode, maxResponseSize } = this
|
|
737
595
|
|
|
@@ -744,6 +602,7 @@ class Parser {
|
|
|
744
602
|
|
|
745
603
|
assert(this.timeoutType === TIMEOUT_BODY)
|
|
746
604
|
if (this.timeout) {
|
|
605
|
+
// istanbul ignore else: only for jest
|
|
747
606
|
if (this.timeout.refresh) {
|
|
748
607
|
this.timeout.refresh()
|
|
749
608
|
}
|
|
@@ -758,16 +617,11 @@ class Parser {
|
|
|
758
617
|
|
|
759
618
|
this.bytesRead += buf.length
|
|
760
619
|
|
|
761
|
-
if (request.
|
|
620
|
+
if (request.onData(buf) === false) {
|
|
762
621
|
return constants.ERROR.PAUSED
|
|
763
622
|
}
|
|
764
|
-
|
|
765
|
-
return 0
|
|
766
623
|
}
|
|
767
624
|
|
|
768
|
-
/**
|
|
769
|
-
* @returns {number}
|
|
770
|
-
*/
|
|
771
625
|
onMessageComplete () {
|
|
772
626
|
const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this
|
|
773
627
|
|
|
@@ -776,7 +630,7 @@ class Parser {
|
|
|
776
630
|
}
|
|
777
631
|
|
|
778
632
|
if (upgrade) {
|
|
779
|
-
return
|
|
633
|
+
return
|
|
780
634
|
}
|
|
781
635
|
|
|
782
636
|
assert(statusCode >= 100)
|
|
@@ -785,29 +639,30 @@ class Parser {
|
|
|
785
639
|
const request = client[kQueue][client[kRunningIdx]]
|
|
786
640
|
assert(request)
|
|
787
641
|
|
|
788
|
-
this.statusCode =
|
|
642
|
+
this.statusCode = null
|
|
789
643
|
this.statusText = ''
|
|
790
644
|
this.bytesRead = 0
|
|
791
|
-
this.contentLength =
|
|
645
|
+
this.contentLength = ''
|
|
792
646
|
this.keepAlive = ''
|
|
793
|
-
this.
|
|
647
|
+
this.connection = ''
|
|
794
648
|
|
|
795
649
|
this.headers = []
|
|
796
650
|
this.headersSize = 0
|
|
797
651
|
|
|
798
652
|
if (statusCode < 200) {
|
|
799
|
-
return
|
|
653
|
+
return
|
|
800
654
|
}
|
|
801
655
|
|
|
802
|
-
|
|
656
|
+
/* istanbul ignore next: should be handled by llhttp? */
|
|
657
|
+
if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
|
803
658
|
util.destroy(socket, new ResponseContentLengthMismatchError())
|
|
804
659
|
return -1
|
|
805
660
|
}
|
|
806
661
|
|
|
807
|
-
request.
|
|
662
|
+
request.onComplete(headers)
|
|
808
663
|
|
|
809
664
|
client[kQueue][client[kRunningIdx]++] = null
|
|
810
|
-
socket[kSocketUsed] =
|
|
665
|
+
socket[kSocketUsed] = true
|
|
811
666
|
|
|
812
667
|
if (socket[kWriting]) {
|
|
813
668
|
assert(client[kRunning] === 0)
|
|
@@ -828,23 +683,17 @@ class Parser {
|
|
|
828
683
|
// We must wait a full event loop cycle to reuse this socket to make sure
|
|
829
684
|
// that non-spec compliant servers are not closing the connection even if they
|
|
830
685
|
// said they won't.
|
|
831
|
-
setImmediate(client[kResume])
|
|
686
|
+
setImmediate(() => client[kResume]())
|
|
832
687
|
} else {
|
|
833
688
|
client[kResume]()
|
|
834
689
|
}
|
|
835
|
-
|
|
836
|
-
return 0
|
|
837
690
|
}
|
|
838
691
|
}
|
|
839
692
|
|
|
840
|
-
function onParserTimeout (
|
|
841
|
-
const
|
|
842
|
-
if (!parser) {
|
|
843
|
-
return
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
const { socket, timeoutType, client, paused } = parser
|
|
693
|
+
function onParserTimeout (parser) {
|
|
694
|
+
const { socket, timeoutType, client, paused } = parser.deref()
|
|
847
695
|
|
|
696
|
+
/* istanbul ignore else */
|
|
848
697
|
if (timeoutType === TIMEOUT_HEADERS) {
|
|
849
698
|
if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
|
|
850
699
|
assert(!paused, 'cannot be paused while waiting for headers')
|
|
@@ -860,24 +709,12 @@ function onParserTimeout (parserWeakRef) {
|
|
|
860
709
|
}
|
|
861
710
|
}
|
|
862
711
|
|
|
863
|
-
|
|
864
|
-
* @param {import ('./client.js')} client
|
|
865
|
-
* @param {import('net').Socket} socket
|
|
866
|
-
* @returns
|
|
867
|
-
*/
|
|
868
|
-
function connectH1 (client, socket) {
|
|
712
|
+
async function connectH1 (client, socket) {
|
|
869
713
|
client[kSocket] = socket
|
|
870
714
|
|
|
871
715
|
if (!llhttpInstance) {
|
|
872
|
-
llhttpInstance =
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
if (socket.errored) {
|
|
876
|
-
throw socket.errored
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
if (socket.destroyed) {
|
|
880
|
-
throw new SocketError('destroyed')
|
|
716
|
+
llhttpInstance = await llhttpPromise
|
|
717
|
+
llhttpPromise = null
|
|
881
718
|
}
|
|
882
719
|
|
|
883
720
|
socket[kNoRef] = false
|
|
@@ -889,45 +726,116 @@ function connectH1 (client, socket) {
|
|
|
889
726
|
socket[kSocketUsed] = false
|
|
890
727
|
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
|
891
728
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
729
|
+
addListener(socket, 'error', function (err) {
|
|
730
|
+
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
|
731
|
+
|
|
732
|
+
const parser = this[kParser]
|
|
733
|
+
|
|
734
|
+
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
|
735
|
+
// to the user.
|
|
736
|
+
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
|
737
|
+
const parserErr = parser.finish()
|
|
738
|
+
if (parserErr) {
|
|
739
|
+
this[kError] = parserErr
|
|
740
|
+
this[kClient][kOnError](parserErr)
|
|
741
|
+
}
|
|
742
|
+
return
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
this[kError] = err
|
|
746
|
+
|
|
747
|
+
this[kClient][kOnError](err)
|
|
748
|
+
})
|
|
749
|
+
addListener(socket, 'readable', function () {
|
|
750
|
+
const parser = this[kParser]
|
|
751
|
+
|
|
752
|
+
if (parser) {
|
|
753
|
+
parser.readMore()
|
|
754
|
+
}
|
|
755
|
+
})
|
|
756
|
+
addListener(socket, 'end', function () {
|
|
757
|
+
const parser = this[kParser]
|
|
758
|
+
|
|
759
|
+
if (parser.statusCode && !parser.shouldKeepAlive) {
|
|
760
|
+
const parserErr = parser.finish()
|
|
761
|
+
if (parserErr) {
|
|
762
|
+
util.destroy(this, parserErr)
|
|
763
|
+
}
|
|
764
|
+
return
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
|
|
768
|
+
})
|
|
769
|
+
addListener(socket, 'close', function () {
|
|
770
|
+
const client = this[kClient]
|
|
771
|
+
const parser = this[kParser]
|
|
772
|
+
|
|
773
|
+
clearIdleSocketValidation(this)
|
|
774
|
+
|
|
775
|
+
if (parser) {
|
|
776
|
+
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
|
777
|
+
this[kError] = parser.finish() || this[kError]
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
this[kParser].destroy()
|
|
781
|
+
this[kParser] = null
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
|
|
785
|
+
|
|
786
|
+
client[kSocket] = null
|
|
787
|
+
client[kHTTPContext] = null // TODO (fix): This is hacky...
|
|
788
|
+
|
|
789
|
+
if (client.destroyed) {
|
|
790
|
+
assert(client[kPending] === 0)
|
|
791
|
+
|
|
792
|
+
// Fail entire queue.
|
|
793
|
+
const requests = client[kQueue].splice(client[kRunningIdx])
|
|
794
|
+
for (let i = 0; i < requests.length; i++) {
|
|
795
|
+
const request = requests[i]
|
|
796
|
+
util.errorRequest(client, request, err)
|
|
797
|
+
}
|
|
798
|
+
} else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') {
|
|
799
|
+
// Fail head of pipeline.
|
|
800
|
+
const request = client[kQueue][client[kRunningIdx]]
|
|
801
|
+
client[kQueue][client[kRunningIdx]++] = null
|
|
802
|
+
|
|
803
|
+
util.errorRequest(client, request, err)
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
client[kPendingIdx] = client[kRunningIdx]
|
|
807
|
+
|
|
808
|
+
assert(client[kRunning] === 0)
|
|
896
809
|
|
|
897
|
-
|
|
898
|
-
|
|
810
|
+
client.emit('disconnect', client[kUrl], [client], err)
|
|
811
|
+
|
|
812
|
+
client[kResume]()
|
|
813
|
+
})
|
|
814
|
+
|
|
815
|
+
let closed = false
|
|
816
|
+
socket.on('close', () => {
|
|
817
|
+
closed = true
|
|
818
|
+
})
|
|
899
819
|
|
|
900
820
|
return {
|
|
901
821
|
version: 'h1',
|
|
902
822
|
defaultPipelining: 1,
|
|
903
|
-
write (
|
|
904
|
-
return writeH1(client,
|
|
823
|
+
write (...args) {
|
|
824
|
+
return writeH1(client, ...args)
|
|
905
825
|
},
|
|
906
826
|
resume () {
|
|
907
827
|
resumeH1(client)
|
|
908
828
|
},
|
|
909
|
-
/**
|
|
910
|
-
* @param {Error|undefined} err
|
|
911
|
-
* @param {() => void} callback
|
|
912
|
-
*/
|
|
913
829
|
destroy (err, callback) {
|
|
914
|
-
if (
|
|
830
|
+
if (closed) {
|
|
915
831
|
queueMicrotask(callback)
|
|
916
832
|
} else {
|
|
917
|
-
socket.on('close', callback)
|
|
918
|
-
socket.destroy(err)
|
|
833
|
+
socket.destroy(err).on('close', callback)
|
|
919
834
|
}
|
|
920
835
|
},
|
|
921
|
-
/**
|
|
922
|
-
* @returns {boolean}
|
|
923
|
-
*/
|
|
924
836
|
get destroyed () {
|
|
925
837
|
return socket.destroyed
|
|
926
838
|
},
|
|
927
|
-
/**
|
|
928
|
-
* @param {import('../core/request.js')} request
|
|
929
|
-
* @returns {boolean}
|
|
930
|
-
*/
|
|
931
839
|
busy (request) {
|
|
932
840
|
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
|
|
933
841
|
return true
|
|
@@ -967,96 +875,6 @@ function connectH1 (client, socket) {
|
|
|
967
875
|
}
|
|
968
876
|
}
|
|
969
877
|
|
|
970
|
-
function onHttpSocketError (err) {
|
|
971
|
-
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
|
972
|
-
|
|
973
|
-
const parser = this[kParser]
|
|
974
|
-
|
|
975
|
-
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
|
976
|
-
// to the user.
|
|
977
|
-
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
|
978
|
-
const parserErr = parser.finish()
|
|
979
|
-
if (parserErr) {
|
|
980
|
-
this[kError] = parserErr
|
|
981
|
-
this[kClient][kOnError](parserErr)
|
|
982
|
-
}
|
|
983
|
-
return
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
this[kError] = err
|
|
987
|
-
|
|
988
|
-
this[kClient][kOnError](err)
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
function onHttpSocketReadable () {
|
|
992
|
-
this[kParser]?.readMore()
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
function onHttpSocketEnd () {
|
|
996
|
-
const parser = this[kParser]
|
|
997
|
-
|
|
998
|
-
if (parser.statusCode && !parser.shouldKeepAlive) {
|
|
999
|
-
const parserErr = parser.finish()
|
|
1000
|
-
if (parserErr) {
|
|
1001
|
-
util.destroy(this, parserErr)
|
|
1002
|
-
}
|
|
1003
|
-
return
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
function onHttpSocketClose () {
|
|
1010
|
-
const parser = this[kParser]
|
|
1011
|
-
|
|
1012
|
-
clearIdleSocketValidation(this)
|
|
1013
|
-
|
|
1014
|
-
if (parser) {
|
|
1015
|
-
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
|
1016
|
-
this[kError] = parser.finish() || this[kError]
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
this[kParser].destroy()
|
|
1020
|
-
this[kParser] = null
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
|
|
1024
|
-
|
|
1025
|
-
const client = this[kClient]
|
|
1026
|
-
|
|
1027
|
-
client[kSocket] = null
|
|
1028
|
-
client[kHTTPContext] = null // TODO (fix): This is hacky...
|
|
1029
|
-
|
|
1030
|
-
if (client.destroyed) {
|
|
1031
|
-
assert(client[kPending] === 0)
|
|
1032
|
-
|
|
1033
|
-
// Fail entire queue.
|
|
1034
|
-
const requests = client[kQueue].splice(client[kRunningIdx])
|
|
1035
|
-
for (let i = 0; i < requests.length; i++) {
|
|
1036
|
-
const request = requests[i]
|
|
1037
|
-
util.errorRequest(client, request, err)
|
|
1038
|
-
}
|
|
1039
|
-
} else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') {
|
|
1040
|
-
// Fail head of pipeline.
|
|
1041
|
-
const request = client[kQueue][client[kRunningIdx]]
|
|
1042
|
-
client[kQueue][client[kRunningIdx]++] = null
|
|
1043
|
-
|
|
1044
|
-
util.errorRequest(client, request, err)
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
client[kPendingIdx] = client[kRunningIdx]
|
|
1048
|
-
|
|
1049
|
-
assert(client[kRunning] === 0)
|
|
1050
|
-
|
|
1051
|
-
client.emit('disconnect', client[kUrl], [client], err)
|
|
1052
|
-
|
|
1053
|
-
client[kResume]()
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
function onSocketClose () {
|
|
1057
|
-
this[kClosed] = true
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
878
|
function clearIdleSocketValidation (socket) {
|
|
1061
879
|
if (socket[kIdleSocketValidationTimeout]) {
|
|
1062
880
|
clearImmediate(socket[kIdleSocketValidationTimeout])
|
|
@@ -1151,37 +969,6 @@ function shouldSendContentLength (method) {
|
|
|
1151
969
|
return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
|
|
1152
970
|
}
|
|
1153
971
|
|
|
1154
|
-
function setTypeOfService (socket, request) {
|
|
1155
|
-
if (typeof socket.setTypeOfService !== 'function') {
|
|
1156
|
-
return
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
const typeOfService = request.typeOfService
|
|
1160
|
-
|
|
1161
|
-
if (typeOfService === undefined) {
|
|
1162
|
-
return
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
const currentTypeOfService = socket[kTypeOfService]
|
|
1166
|
-
|
|
1167
|
-
if (currentTypeOfService === typeOfService) {
|
|
1168
|
-
return
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
try {
|
|
1172
|
-
socket.setTypeOfService(typeOfService)
|
|
1173
|
-
socket[kTypeOfService] = typeOfService
|
|
1174
|
-
} catch {
|
|
1175
|
-
// QoS marking is best-effort. setTypeOfService() can throw synchronously on
|
|
1176
|
-
// some platforms depending on socket state, but that must not abort the request.
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
/**
|
|
1181
|
-
* @param {import('./client.js')} client
|
|
1182
|
-
* @param {import('../core/request.js')} request
|
|
1183
|
-
* @returns
|
|
1184
|
-
*/
|
|
1185
972
|
function writeH1 (client, request) {
|
|
1186
973
|
const { method, path, host, upgrade, blocking, reset } = request
|
|
1187
974
|
|
|
@@ -1265,22 +1052,28 @@ function writeH1 (client, request) {
|
|
|
1265
1052
|
clearIdleSocketValidation(socket)
|
|
1266
1053
|
|
|
1267
1054
|
/**
|
|
1268
|
-
* @param {Error} [
|
|
1269
|
-
* @returns {void}
|
|
1055
|
+
* @param {Error} [error]
|
|
1270
1056
|
*/
|
|
1271
|
-
const abort = (
|
|
1272
|
-
if (request.aborted
|
|
1057
|
+
const abort = (error) => {
|
|
1058
|
+
if (request.aborted) {
|
|
1059
|
+
return
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
if (request.completed) {
|
|
1063
|
+
if (request.upgrade || request.method === 'CONNECT') {
|
|
1064
|
+
util.destroy(socket, new InformationalError('aborted'))
|
|
1065
|
+
}
|
|
1273
1066
|
return
|
|
1274
1067
|
}
|
|
1275
1068
|
|
|
1276
|
-
util.errorRequest(client, request,
|
|
1069
|
+
util.errorRequest(client, request, error || new RequestAbortedError())
|
|
1277
1070
|
|
|
1278
1071
|
util.destroy(body)
|
|
1279
1072
|
util.destroy(socket, new InformationalError('aborted'))
|
|
1280
1073
|
}
|
|
1281
1074
|
|
|
1282
1075
|
try {
|
|
1283
|
-
request.
|
|
1076
|
+
request.onConnect(abort)
|
|
1284
1077
|
} catch (err) {
|
|
1285
1078
|
util.errorRequest(client, request, err)
|
|
1286
1079
|
}
|
|
@@ -1308,7 +1101,7 @@ function writeH1 (client, request) {
|
|
|
1308
1101
|
socket[kReset] = reset
|
|
1309
1102
|
}
|
|
1310
1103
|
|
|
1311
|
-
if (client[kMaxRequests] &&
|
|
1104
|
+
if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) {
|
|
1312
1105
|
socket[kReset] = true
|
|
1313
1106
|
}
|
|
1314
1107
|
|
|
@@ -1316,8 +1109,6 @@ function writeH1 (client, request) {
|
|
|
1316
1109
|
socket[kBlocking] = true
|
|
1317
1110
|
}
|
|
1318
1111
|
|
|
1319
|
-
setTypeOfService(socket, request)
|
|
1320
|
-
|
|
1321
1112
|
let header = `${method} ${path} HTTP/1.1\r\n`
|
|
1322
1113
|
|
|
1323
1114
|
if (typeof host === 'string') {
|
|
@@ -1353,6 +1144,7 @@ function writeH1 (client, request) {
|
|
|
1353
1144
|
channels.sendHeaders.publish({ request, headers: header, socket })
|
|
1354
1145
|
}
|
|
1355
1146
|
|
|
1147
|
+
/* istanbul ignore else: assertion */
|
|
1356
1148
|
if (!body || bodyLength === 0) {
|
|
1357
1149
|
writeBuffer(abort, null, client, request, socket, contentLength, header, expectsPayload)
|
|
1358
1150
|
} else if (util.isBuffer(body)) {
|
|
@@ -1374,16 +1166,6 @@ function writeH1 (client, request) {
|
|
|
1374
1166
|
return true
|
|
1375
1167
|
}
|
|
1376
1168
|
|
|
1377
|
-
/**
|
|
1378
|
-
* @param {AbortCallback} abort
|
|
1379
|
-
* @param {import('stream').Stream} body
|
|
1380
|
-
* @param {import('./client.js')} client
|
|
1381
|
-
* @param {import('../core/request.js')} request
|
|
1382
|
-
* @param {import('net').Socket} socket
|
|
1383
|
-
* @param {number} contentLength
|
|
1384
|
-
* @param {string} header
|
|
1385
|
-
* @param {boolean} expectsPayload
|
|
1386
|
-
*/
|
|
1387
1169
|
function writeStream (abort, body, client, request, socket, contentLength, header, expectsPayload) {
|
|
1388
1170
|
assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined')
|
|
1389
1171
|
|
|
@@ -1391,10 +1173,6 @@ function writeStream (abort, body, client, request, socket, contentLength, heade
|
|
|
1391
1173
|
|
|
1392
1174
|
const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header })
|
|
1393
1175
|
|
|
1394
|
-
/**
|
|
1395
|
-
* @param {Buffer} chunk
|
|
1396
|
-
* @returns {void}
|
|
1397
|
-
*/
|
|
1398
1176
|
const onData = function (chunk) {
|
|
1399
1177
|
if (finished) {
|
|
1400
1178
|
return
|
|
@@ -1408,10 +1186,6 @@ function writeStream (abort, body, client, request, socket, contentLength, heade
|
|
|
1408
1186
|
util.destroy(this, err)
|
|
1409
1187
|
}
|
|
1410
1188
|
}
|
|
1411
|
-
|
|
1412
|
-
/**
|
|
1413
|
-
* @returns {void}
|
|
1414
|
-
*/
|
|
1415
1189
|
const onDrain = function () {
|
|
1416
1190
|
if (finished) {
|
|
1417
1191
|
return
|
|
@@ -1421,10 +1195,6 @@ function writeStream (abort, body, client, request, socket, contentLength, heade
|
|
|
1421
1195
|
body.resume()
|
|
1422
1196
|
}
|
|
1423
1197
|
}
|
|
1424
|
-
|
|
1425
|
-
/**
|
|
1426
|
-
* @returns {void}
|
|
1427
|
-
*/
|
|
1428
1198
|
const onClose = function () {
|
|
1429
1199
|
// 'close' might be emitted *before* 'error' for
|
|
1430
1200
|
// broken streams. Wait a tick to avoid this case.
|
|
@@ -1439,11 +1209,6 @@ function writeStream (abort, body, client, request, socket, contentLength, heade
|
|
|
1439
1209
|
queueMicrotask(() => onFinished(err))
|
|
1440
1210
|
}
|
|
1441
1211
|
}
|
|
1442
|
-
|
|
1443
|
-
/**
|
|
1444
|
-
* @param {Error} [err]
|
|
1445
|
-
* @returns
|
|
1446
|
-
*/
|
|
1447
1212
|
const onFinished = function (err) {
|
|
1448
1213
|
if (finished) {
|
|
1449
1214
|
return
|
|
@@ -1494,9 +1259,9 @@ function writeStream (abort, body, client, request, socket, contentLength, heade
|
|
|
1494
1259
|
.on('error', onFinished)
|
|
1495
1260
|
|
|
1496
1261
|
if (body.errorEmitted ?? body.errored) {
|
|
1497
|
-
setImmediate(onFinished
|
|
1262
|
+
setImmediate(() => onFinished(body.errored))
|
|
1498
1263
|
} else if (body.endEmitted ?? body.readableEnded) {
|
|
1499
|
-
setImmediate(onFinished
|
|
1264
|
+
setImmediate(() => onFinished(null))
|
|
1500
1265
|
}
|
|
1501
1266
|
|
|
1502
1267
|
if (body.closeEmitted ?? body.closed) {
|
|
@@ -1504,24 +1269,6 @@ function writeStream (abort, body, client, request, socket, contentLength, heade
|
|
|
1504
1269
|
}
|
|
1505
1270
|
}
|
|
1506
1271
|
|
|
1507
|
-
/**
|
|
1508
|
-
* @typedef AbortCallback
|
|
1509
|
-
* @type {Function}
|
|
1510
|
-
* @param {Error} [err]
|
|
1511
|
-
* @returns {void}
|
|
1512
|
-
*/
|
|
1513
|
-
|
|
1514
|
-
/**
|
|
1515
|
-
* @param {AbortCallback} abort
|
|
1516
|
-
* @param {Uint8Array|null} body
|
|
1517
|
-
* @param {import('./client.js')} client
|
|
1518
|
-
* @param {import('../core/request.js')} request
|
|
1519
|
-
* @param {import('net').Socket} socket
|
|
1520
|
-
* @param {number} contentLength
|
|
1521
|
-
* @param {string} header
|
|
1522
|
-
* @param {boolean} expectsPayload
|
|
1523
|
-
* @returns {void}
|
|
1524
|
-
*/
|
|
1525
1272
|
function writeBuffer (abort, body, client, request, socket, contentLength, header, expectsPayload) {
|
|
1526
1273
|
try {
|
|
1527
1274
|
if (!body) {
|
|
@@ -1552,18 +1299,9 @@ function writeBuffer (abort, body, client, request, socket, contentLength, heade
|
|
|
1552
1299
|
}
|
|
1553
1300
|
}
|
|
1554
1301
|
|
|
1555
|
-
/**
|
|
1556
|
-
* @param {AbortCallback} abort
|
|
1557
|
-
* @param {Blob} body
|
|
1558
|
-
* @param {import('./client.js')} client
|
|
1559
|
-
* @param {import('../core/request.js')} request
|
|
1560
|
-
* @param {import('net').Socket} socket
|
|
1561
|
-
* @param {number} contentLength
|
|
1562
|
-
* @param {string} header
|
|
1563
|
-
* @param {boolean} expectsPayload
|
|
1564
|
-
* @returns {Promise<void>}
|
|
1565
|
-
*/
|
|
1566
1302
|
async function writeBlob (abort, body, client, request, socket, contentLength, header, expectsPayload) {
|
|
1303
|
+
assert(contentLength === body.size, 'blob body must have content length')
|
|
1304
|
+
|
|
1567
1305
|
try {
|
|
1568
1306
|
if (contentLength != null && contentLength !== body.size) {
|
|
1569
1307
|
throw new RequestContentLengthMismatchError()
|
|
@@ -1589,17 +1327,6 @@ async function writeBlob (abort, body, client, request, socket, contentLength, h
|
|
|
1589
1327
|
}
|
|
1590
1328
|
}
|
|
1591
1329
|
|
|
1592
|
-
/**
|
|
1593
|
-
* @param {AbortCallback} abort
|
|
1594
|
-
* @param {Iterable} body
|
|
1595
|
-
* @param {import('./client.js')} client
|
|
1596
|
-
* @param {import('../core/request.js')} request
|
|
1597
|
-
* @param {import('net').Socket} socket
|
|
1598
|
-
* @param {number} contentLength
|
|
1599
|
-
* @param {string} header
|
|
1600
|
-
* @param {boolean} expectsPayload
|
|
1601
|
-
* @returns {Promise<void>}
|
|
1602
|
-
*/
|
|
1603
1330
|
async function writeIterable (abort, body, client, request, socket, contentLength, header, expectsPayload) {
|
|
1604
1331
|
assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined')
|
|
1605
1332
|
|
|
@@ -1650,17 +1377,6 @@ async function writeIterable (abort, body, client, request, socket, contentLengt
|
|
|
1650
1377
|
}
|
|
1651
1378
|
|
|
1652
1379
|
class AsyncWriter {
|
|
1653
|
-
/**
|
|
1654
|
-
*
|
|
1655
|
-
* @param {object} arg
|
|
1656
|
-
* @param {AbortCallback} arg.abort
|
|
1657
|
-
* @param {import('net').Socket} arg.socket
|
|
1658
|
-
* @param {import('../core/request.js')} arg.request
|
|
1659
|
-
* @param {number} arg.contentLength
|
|
1660
|
-
* @param {import('./client.js')} arg.client
|
|
1661
|
-
* @param {boolean} arg.expectsPayload
|
|
1662
|
-
* @param {string} arg.header
|
|
1663
|
-
*/
|
|
1664
1380
|
constructor ({ abort, socket, request, contentLength, client, expectsPayload, header }) {
|
|
1665
1381
|
this.socket = socket
|
|
1666
1382
|
this.request = request
|
|
@@ -1674,10 +1390,6 @@ class AsyncWriter {
|
|
|
1674
1390
|
socket[kWriting] = true
|
|
1675
1391
|
}
|
|
1676
1392
|
|
|
1677
|
-
/**
|
|
1678
|
-
* @param {string|Uint8Array} chunk
|
|
1679
|
-
* @returns
|
|
1680
|
-
*/
|
|
1681
1393
|
write (chunk) {
|
|
1682
1394
|
const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this
|
|
1683
1395
|
|
|
@@ -1689,7 +1401,7 @@ class AsyncWriter {
|
|
|
1689
1401
|
return false
|
|
1690
1402
|
}
|
|
1691
1403
|
|
|
1692
|
-
const len =
|
|
1404
|
+
const len = Buffer.byteLength(chunk)
|
|
1693
1405
|
if (!len) {
|
|
1694
1406
|
return true
|
|
1695
1407
|
}
|
|
@@ -1731,6 +1443,7 @@ class AsyncWriter {
|
|
|
1731
1443
|
|
|
1732
1444
|
if (!ret) {
|
|
1733
1445
|
if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
|
|
1446
|
+
// istanbul ignore else: only for jest
|
|
1734
1447
|
if (socket[kParser].timeout.refresh) {
|
|
1735
1448
|
socket[kParser].timeout.refresh()
|
|
1736
1449
|
}
|
|
@@ -1740,9 +1453,6 @@ class AsyncWriter {
|
|
|
1740
1453
|
return ret
|
|
1741
1454
|
}
|
|
1742
1455
|
|
|
1743
|
-
/**
|
|
1744
|
-
* @returns {void}
|
|
1745
|
-
*/
|
|
1746
1456
|
end () {
|
|
1747
1457
|
const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this
|
|
1748
1458
|
request.onRequestSent()
|
|
@@ -1781,6 +1491,7 @@ class AsyncWriter {
|
|
|
1781
1491
|
}
|
|
1782
1492
|
|
|
1783
1493
|
if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
|
|
1494
|
+
// istanbul ignore else: only for jest
|
|
1784
1495
|
if (socket[kParser].timeout.refresh) {
|
|
1785
1496
|
socket[kParser].timeout.refresh()
|
|
1786
1497
|
}
|
|
@@ -1789,10 +1500,6 @@ class AsyncWriter {
|
|
|
1789
1500
|
client[kResume]()
|
|
1790
1501
|
}
|
|
1791
1502
|
|
|
1792
|
-
/**
|
|
1793
|
-
* @param {Error} [err]
|
|
1794
|
-
* @returns {void}
|
|
1795
|
-
*/
|
|
1796
1503
|
destroy (err) {
|
|
1797
1504
|
const { socket, client, abort } = this
|
|
1798
1505
|
|