@relative-ci/core 5.2.2-beta.0 → 5.3.0-alpha.0
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/lib/cjs/__/@actions/github/__/@octokit/auth-token/dist-bundle/index.js +57 -0
- package/lib/cjs/__/@actions/github/__/@octokit/auth-token/dist-bundle/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/core/dist-src/index.js +144 -0
- package/lib/cjs/__/@actions/github/__/@octokit/core/dist-src/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/core/dist-src/version.js +6 -0
- package/lib/cjs/__/@actions/github/__/@octokit/core/dist-src/version.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/endpoint/dist-bundle/index.js +349 -0
- package/lib/cjs/__/@actions/github/__/@octokit/endpoint/dist-bundle/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/graphql/dist-bundle/index.js +125 -0
- package/lib/cjs/__/@actions/github/__/@octokit/graphql/dist-bundle/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-paginate-rest/dist-bundle/index.js +417 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-paginate-rest/dist-bundle/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js +128 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js +2295 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/index.js +24 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/version.js +6 -0
- package/lib/cjs/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/version.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/request/dist-bundle/index.js +199 -0
- package/lib/cjs/__/@actions/github/__/@octokit/request/dist-bundle/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/@octokit/request-error/dist-src/index.js +43 -0
- package/lib/cjs/__/@actions/github/__/@octokit/request-error/dist-src/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/index.js +41 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/lib/add.js +51 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/lib/add.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/lib/register.js +32 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/lib/register.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/lib/remove.js +24 -0
- package/lib/cjs/__/@actions/github/__/before-after-hook/lib/remove.js.map +1 -0
- package/lib/cjs/__/@actions/github/__/universal-user-agent/index.js +18 -0
- package/lib/cjs/__/@actions/github/__/universal-user-agent/index.js.map +1 -0
- package/lib/cjs/__/@actions/github/lib/context.js +76 -0
- package/lib/cjs/__/@actions/github/lib/context.js.map +1 -0
- package/lib/cjs/__/@actions/github/lib/github.js +66 -0
- package/lib/cjs/__/@actions/github/lib/github.js.map +1 -0
- package/lib/cjs/__/@actions/github/lib/internal/utils.js +94 -0
- package/lib/cjs/__/@actions/github/lib/internal/utils.js.map +1 -0
- package/lib/cjs/__/@actions/github/lib/utils.js +89 -0
- package/lib/cjs/__/@actions/github/lib/utils.js.map +1 -0
- package/lib/cjs/__/@actions/http-client/lib/index.js +760 -0
- package/lib/cjs/__/@actions/http-client/lib/index.js.map +1 -0
- package/lib/cjs/__/@actions/http-client/lib/proxy.js +107 -0
- package/lib/cjs/__/@actions/http-client/lib/proxy.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/deps/dicer/lib/Dicer.js +236 -0
- package/lib/cjs/__/@fastify/busboy/deps/dicer/lib/Dicer.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/deps/dicer/lib/HeaderParser.js +122 -0
- package/lib/cjs/__/@fastify/busboy/deps/dicer/lib/HeaderParser.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/deps/dicer/lib/PartStream.js +33 -0
- package/lib/cjs/__/@fastify/busboy/deps/dicer/lib/PartStream.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/deps/streamsearch/sbmh.js +248 -0
- package/lib/cjs/__/@fastify/busboy/deps/streamsearch/sbmh.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/main.js +109 -0
- package/lib/cjs/__/@fastify/busboy/lib/main.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/types/multipart.js +331 -0
- package/lib/cjs/__/@fastify/busboy/lib/types/multipart.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/types/urlencoded.js +206 -0
- package/lib/cjs/__/@fastify/busboy/lib/types/urlencoded.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/Decoder.js +66 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/Decoder.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/basename.js +26 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/basename.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/decodeText.js +126 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/decodeText.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/getLimit.js +28 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/getLimit.js.map +1 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/parseParams.js +211 -0
- package/lib/cjs/__/@fastify/busboy/lib/utils/parseParams.js.map +1 -0
- package/lib/cjs/__/cross-spawn/index.js +1 -1
- package/lib/cjs/__/env-ci/__/execa/index.js +3 -3
- package/lib/cjs/__/env-ci/__/execa/index.js.map +1 -1
- package/lib/cjs/__/env-ci/__/execa/lib/stream.js +1 -1
- package/lib/cjs/__/env-ci/__/execa/lib/verbose.js +2 -2
- package/lib/cjs/__/env-ci/__/execa/lib/verbose.js.map +1 -1
- package/lib/cjs/__/env-ci/__/npm-run-path/index.js +3 -3
- package/lib/cjs/__/env-ci/__/npm-run-path/index.js.map +1 -1
- package/lib/cjs/__/fast-content-type-parse/index.js +182 -0
- package/lib/cjs/__/fast-content-type-parse/index.js.map +1 -0
- package/lib/cjs/__/java-properties/dist-node/index.js +1 -1
- package/lib/cjs/__/path-key/index.js +1 -1
- package/lib/cjs/__/tunnel/index.js +16 -0
- package/lib/cjs/__/tunnel/index.js.map +1 -0
- package/lib/cjs/__/tunnel/lib/tunnel.js +289 -0
- package/lib/cjs/__/tunnel/lib/tunnel.js.map +1 -0
- package/lib/cjs/__/undici/index.js +212 -0
- package/lib/cjs/__/undici/index.js.map +1 -0
- package/lib/cjs/__/undici/lib/agent.js +169 -0
- package/lib/cjs/__/undici/lib/agent.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/abort-signal.js +70 -0
- package/lib/cjs/__/undici/lib/api/abort-signal.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/api-connect.js +125 -0
- package/lib/cjs/__/undici/lib/api/api-connect.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/api-pipeline.js +274 -0
- package/lib/cjs/__/undici/lib/api/api-pipeline.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/api-request.js +203 -0
- package/lib/cjs/__/undici/lib/api/api-request.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/api-stream.js +244 -0
- package/lib/cjs/__/undici/lib/api/api-stream.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/api-upgrade.js +128 -0
- package/lib/cjs/__/undici/lib/api/api-upgrade.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/index.js +25 -0
- package/lib/cjs/__/undici/lib/api/index.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/readable.js +342 -0
- package/lib/cjs/__/undici/lib/api/readable.js.map +1 -0
- package/lib/cjs/__/undici/lib/api/util.js +67 -0
- package/lib/cjs/__/undici/lib/api/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/balanced-pool.js +208 -0
- package/lib/cjs/__/undici/lib/balanced-pool.js.map +1 -0
- package/lib/cjs/__/undici/lib/cache/cache.js +867 -0
- package/lib/cjs/__/undici/lib/cache/cache.js.map +1 -0
- package/lib/cjs/__/undici/lib/cache/cachestorage.js +161 -0
- package/lib/cjs/__/undici/lib/cache/cachestorage.js.map +1 -0
- package/lib/cjs/__/undici/lib/cache/symbols.js +19 -0
- package/lib/cjs/__/undici/lib/cache/symbols.js.map +1 -0
- package/lib/cjs/__/undici/lib/cache/util.js +69 -0
- package/lib/cjs/__/undici/lib/cache/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/client.js +2314 -0
- package/lib/cjs/__/undici/lib/client.js.map +1 -0
- package/lib/cjs/__/undici/lib/compat/dispatcher-weakref.js +63 -0
- package/lib/cjs/__/undici/lib/compat/dispatcher-weakref.js.map +1 -0
- package/lib/cjs/__/undici/lib/cookies/constants.js +24 -0
- package/lib/cjs/__/undici/lib/cookies/constants.js.map +1 -0
- package/lib/cjs/__/undici/lib/cookies/index.js +200 -0
- package/lib/cjs/__/undici/lib/cookies/index.js.map +1 -0
- package/lib/cjs/__/undici/lib/cookies/parse.js +338 -0
- package/lib/cjs/__/undici/lib/cookies/parse.js.map +1 -0
- package/lib/cjs/__/undici/lib/cookies/util.js +286 -0
- package/lib/cjs/__/undici/lib/cookies/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/core/connect.js +214 -0
- package/lib/cjs/__/undici/lib/core/connect.js.map +1 -0
- package/lib/cjs/__/undici/lib/core/constants.js +130 -0
- package/lib/cjs/__/undici/lib/core/constants.js.map +1 -0
- package/lib/cjs/__/undici/lib/core/errors.js +242 -0
- package/lib/cjs/__/undici/lib/core/errors.js.map +1 -0
- package/lib/cjs/__/undici/lib/core/request.js +521 -0
- package/lib/cjs/__/undici/lib/core/request.js.map +1 -0
- package/lib/cjs/__/undici/lib/core/symbols.js +76 -0
- package/lib/cjs/__/undici/lib/core/symbols.js.map +1 -0
- package/lib/cjs/__/undici/lib/core/util.js +557 -0
- package/lib/cjs/__/undici/lib/core/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/dispatcher-base.js +208 -0
- package/lib/cjs/__/undici/lib/dispatcher-base.js.map +1 -0
- package/lib/cjs/__/undici/lib/dispatcher.js +37 -0
- package/lib/cjs/__/undici/lib/dispatcher.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/body.js +647 -0
- package/lib/cjs/__/undici/lib/fetch/body.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/constants.js +169 -0
- package/lib/cjs/__/undici/lib/fetch/constants.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/dataURL.js +649 -0
- package/lib/cjs/__/undici/lib/fetch/dataURL.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/file.js +369 -0
- package/lib/cjs/__/undici/lib/fetch/file.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/formdata.js +287 -0
- package/lib/cjs/__/undici/lib/fetch/formdata.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/global.js +52 -0
- package/lib/cjs/__/undici/lib/fetch/global.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/headers.js +609 -0
- package/lib/cjs/__/undici/lib/fetch/headers.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/index.js +2114 -0
- package/lib/cjs/__/undici/lib/fetch/index.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/request.js +979 -0
- package/lib/cjs/__/undici/lib/fetch/request.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/response.js +604 -0
- package/lib/cjs/__/undici/lib/fetch/response.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/symbols.js +22 -0
- package/lib/cjs/__/undici/lib/fetch/symbols.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/util.js +1170 -0
- package/lib/cjs/__/undici/lib/fetch/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/fetch/webidl.js +665 -0
- package/lib/cjs/__/undici/lib/fetch/webidl.js.map +1 -0
- package/lib/cjs/__/undici/lib/fileapi/encoding.js +302 -0
- package/lib/cjs/__/undici/lib/fileapi/encoding.js.map +1 -0
- package/lib/cjs/__/undici/lib/fileapi/filereader.js +361 -0
- package/lib/cjs/__/undici/lib/fileapi/filereader.js.map +1 -0
- package/lib/cjs/__/undici/lib/fileapi/progressevent.js +92 -0
- package/lib/cjs/__/undici/lib/fileapi/progressevent.js.map +1 -0
- package/lib/cjs/__/undici/lib/fileapi/symbols.js +22 -0
- package/lib/cjs/__/undici/lib/fileapi/symbols.js.map +1 -0
- package/lib/cjs/__/undici/lib/fileapi/util.js +419 -0
- package/lib/cjs/__/undici/lib/fileapi/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/global.js +47 -0
- package/lib/cjs/__/undici/lib/global.js.map +1 -0
- package/lib/cjs/__/undici/lib/handler/DecoratorHandler.js +47 -0
- package/lib/cjs/__/undici/lib/handler/DecoratorHandler.js.map +1 -0
- package/lib/cjs/__/undici/lib/handler/RedirectHandler.js +226 -0
- package/lib/cjs/__/undici/lib/handler/RedirectHandler.js.map +1 -0
- package/lib/cjs/__/undici/lib/handler/RetryHandler.js +358 -0
- package/lib/cjs/__/undici/lib/handler/RetryHandler.js.map +1 -0
- package/lib/cjs/__/undici/lib/interceptor/redirectInterceptor.js +35 -0
- package/lib/cjs/__/undici/lib/interceptor/redirectInterceptor.js.map +1 -0
- package/lib/cjs/__/undici/lib/llhttp/constants.js +288 -0
- package/lib/cjs/__/undici/lib/llhttp/constants.js.map +1 -0
- package/lib/cjs/__/undici/lib/llhttp/llhttp-wasm.js +14 -0
- package/lib/cjs/__/undici/lib/llhttp/llhttp-wasm.js.map +1 -0
- package/lib/cjs/__/undici/lib/llhttp/llhttp_simd-wasm.js +14 -0
- package/lib/cjs/__/undici/lib/llhttp/llhttp_simd-wasm.js.map +1 -0
- package/lib/cjs/__/undici/lib/llhttp/utils.js +28 -0
- package/lib/cjs/__/undici/lib/llhttp/utils.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-agent.js +194 -0
- package/lib/cjs/__/undici/lib/mock/mock-agent.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-client.js +83 -0
- package/lib/cjs/__/undici/lib/mock/mock-client.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-errors.js +31 -0
- package/lib/cjs/__/undici/lib/mock/mock-errors.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-interceptor.js +223 -0
- package/lib/cjs/__/undici/lib/mock/mock-interceptor.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-pool.js +83 -0
- package/lib/cjs/__/undici/lib/mock/mock-pool.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-symbols.js +35 -0
- package/lib/cjs/__/undici/lib/mock/mock-symbols.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/mock-utils.js +374 -0
- package/lib/cjs/__/undici/lib/mock/mock-utils.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/pending-interceptors-formatter.js +60 -0
- package/lib/cjs/__/undici/lib/mock/pending-interceptors-formatter.js.map +1 -0
- package/lib/cjs/__/undici/lib/mock/pluralizer.js +41 -0
- package/lib/cjs/__/undici/lib/mock/pluralizer.js.map +1 -0
- package/lib/cjs/__/undici/lib/node/fixed-queue.js +129 -0
- package/lib/cjs/__/undici/lib/node/fixed-queue.js.map +1 -0
- package/lib/cjs/__/undici/lib/pool-base.js +211 -0
- package/lib/cjs/__/undici/lib/pool-base.js.map +1 -0
- package/lib/cjs/__/undici/lib/pool-stats.js +49 -0
- package/lib/cjs/__/undici/lib/pool-stats.js.map +1 -0
- package/lib/cjs/__/undici/lib/pool.js +127 -0
- package/lib/cjs/__/undici/lib/pool.js.map +1 -0
- package/lib/cjs/__/undici/lib/proxy-agent.js +213 -0
- package/lib/cjs/__/undici/lib/proxy-agent.js.map +1 -0
- package/lib/cjs/__/undici/lib/timers.js +109 -0
- package/lib/cjs/__/undici/lib/timers.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/connection.js +318 -0
- package/lib/cjs/__/undici/lib/websocket/connection.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/constants.js +63 -0
- package/lib/cjs/__/undici/lib/websocket/constants.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/events.js +323 -0
- package/lib/cjs/__/undici/lib/websocket/events.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/frame.js +87 -0
- package/lib/cjs/__/undici/lib/websocket/frame.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/receiver.js +368 -0
- package/lib/cjs/__/undici/lib/websocket/receiver.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/symbols.js +24 -0
- package/lib/cjs/__/undici/lib/websocket/symbols.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/util.js +216 -0
- package/lib/cjs/__/undici/lib/websocket/util.js.map +1 -0
- package/lib/cjs/__/undici/lib/websocket/websocket.js +668 -0
- package/lib/cjs/__/undici/lib/websocket/websocket.js.map +1 -0
- package/lib/cjs/_virtual/_commonjsHelpers.js +30 -0
- package/lib/cjs/_virtual/_commonjsHelpers.js.map +1 -1
- package/lib/cjs/_virtual/api-request.js +6 -0
- package/lib/cjs/_virtual/api-request.js.map +1 -0
- package/lib/cjs/_virtual/constants.js +6 -0
- package/lib/cjs/_virtual/constants.js.map +1 -0
- package/lib/cjs/_virtual/context.js +6 -0
- package/lib/cjs/_virtual/context.js.map +1 -0
- package/lib/cjs/_virtual/github.js +8 -0
- package/lib/cjs/_virtual/github.js.map +1 -0
- package/lib/cjs/_virtual/github2.js +6 -0
- package/lib/cjs/_virtual/github2.js.map +1 -0
- package/lib/cjs/_virtual/index10.js +6 -0
- package/lib/cjs/_virtual/index10.js.map +1 -0
- package/lib/cjs/_virtual/index11.js +6 -0
- package/lib/cjs/_virtual/index11.js.map +1 -0
- package/lib/cjs/_virtual/index12.js +6 -0
- package/lib/cjs/_virtual/index12.js.map +1 -0
- package/lib/cjs/_virtual/index13.js +6 -0
- package/lib/cjs/_virtual/index13.js.map +1 -0
- package/lib/cjs/_virtual/index14.js +6 -0
- package/lib/cjs/_virtual/index14.js.map +1 -0
- package/lib/cjs/_virtual/index2.js +5 -2
- package/lib/cjs/_virtual/index2.js.map +1 -1
- package/lib/cjs/_virtual/index3.js +3 -4
- package/lib/cjs/_virtual/index3.js.map +1 -1
- package/lib/cjs/_virtual/index4.js +5 -2
- package/lib/cjs/_virtual/index4.js.map +1 -1
- package/lib/cjs/_virtual/index5.js +2 -2
- package/lib/cjs/_virtual/index6.js +6 -2
- package/lib/cjs/_virtual/index6.js.map +1 -1
- package/lib/cjs/_virtual/index7.js +6 -0
- package/lib/cjs/_virtual/index7.js.map +1 -0
- package/lib/cjs/_virtual/index8.js +6 -0
- package/lib/cjs/_virtual/index8.js.map +1 -0
- package/lib/cjs/_virtual/index9.js +8 -0
- package/lib/cjs/_virtual/index9.js.map +1 -0
- package/lib/cjs/_virtual/main.js +6 -0
- package/lib/cjs/_virtual/main.js.map +1 -0
- package/lib/cjs/_virtual/mock-interceptor.js +6 -0
- package/lib/cjs/_virtual/mock-interceptor.js.map +1 -0
- package/lib/cjs/_virtual/proxy.js +6 -0
- package/lib/cjs/_virtual/proxy.js.map +1 -0
- package/lib/cjs/_virtual/tunnel.js +6 -0
- package/lib/cjs/_virtual/tunnel.js.map +1 -0
- package/lib/cjs/_virtual/utils.js +6 -0
- package/lib/cjs/_virtual/utils.js.map +1 -0
- package/lib/cjs/_virtual/utils2.js +6 -0
- package/lib/cjs/_virtual/utils2.js.map +1 -0
- package/lib/cjs/_virtual/utils3.js +6 -0
- package/lib/cjs/_virtual/utils3.js.map +1 -0
- package/lib/cjs/artifacts/filter-artifacts.js.map +1 -1
- package/lib/cjs/env/ci-env.js +6 -1
- package/lib/cjs/env/ci-env.js.map +1 -1
- package/lib/cjs/env/load.js +1 -1
- package/lib/cjs/env/load.js.map +1 -1
- package/lib/cjs/env/service/github.js +3 -22
- package/lib/cjs/env/service/github.js.map +1 -1
- package/lib/cjs/ingest/ingest.js +4 -4
- package/lib/cjs/ingest/ingest.js.map +1 -1
- package/lib/cjs/locales/en.js.map +1 -1
- package/lib/esm/__/@actions/github/__/@octokit/auth-token/dist-bundle/index.js +55 -0
- package/lib/esm/__/@actions/github/__/@octokit/auth-token/dist-bundle/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/core/dist-src/index.js +142 -0
- package/lib/esm/__/@actions/github/__/@octokit/core/dist-src/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/core/dist-src/version.js +4 -0
- package/lib/esm/__/@actions/github/__/@octokit/core/dist-src/version.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/endpoint/dist-bundle/index.js +347 -0
- package/lib/esm/__/@actions/github/__/@octokit/endpoint/dist-bundle/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/graphql/dist-bundle/index.js +122 -0
- package/lib/esm/__/@actions/github/__/@octokit/graphql/dist-bundle/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-paginate-rest/dist-bundle/index.js +412 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-paginate-rest/dist-bundle/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js +126 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js +2293 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/index.js +21 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/version.js +4 -0
- package/lib/esm/__/@actions/github/__/@octokit/plugin-rest-endpoint-methods/dist-src/version.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/request/dist-bundle/index.js +197 -0
- package/lib/esm/__/@actions/github/__/@octokit/request/dist-bundle/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/@octokit/request-error/dist-src/index.js +41 -0
- package/lib/esm/__/@actions/github/__/@octokit/request-error/dist-src/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/index.js +39 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/index.js.map +1 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/lib/add.js +49 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/lib/add.js.map +1 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/lib/register.js +30 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/lib/register.js.map +1 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/lib/remove.js +22 -0
- package/lib/esm/__/@actions/github/__/before-after-hook/lib/remove.js.map +1 -0
- package/lib/esm/__/@actions/github/__/universal-user-agent/index.js +16 -0
- package/lib/esm/__/@actions/github/__/universal-user-agent/index.js.map +1 -0
- package/lib/esm/__/@actions/github/lib/context.js +69 -0
- package/lib/esm/__/@actions/github/lib/context.js.map +1 -0
- package/lib/esm/__/@actions/github/lib/github.js +64 -0
- package/lib/esm/__/@actions/github/lib/github.js.map +1 -0
- package/lib/esm/__/@actions/github/lib/internal/utils.js +92 -0
- package/lib/esm/__/@actions/github/lib/internal/utils.js.map +1 -0
- package/lib/esm/__/@actions/github/lib/utils.js +87 -0
- package/lib/esm/__/@actions/github/lib/utils.js.map +1 -0
- package/lib/esm/__/@actions/http-client/lib/index.js +753 -0
- package/lib/esm/__/@actions/http-client/lib/index.js.map +1 -0
- package/lib/esm/__/@actions/http-client/lib/proxy.js +105 -0
- package/lib/esm/__/@actions/http-client/lib/proxy.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/deps/dicer/lib/Dicer.js +229 -0
- package/lib/esm/__/@fastify/busboy/deps/dicer/lib/Dicer.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/deps/dicer/lib/HeaderParser.js +115 -0
- package/lib/esm/__/@fastify/busboy/deps/dicer/lib/HeaderParser.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/deps/dicer/lib/PartStream.js +26 -0
- package/lib/esm/__/@fastify/busboy/deps/dicer/lib/PartStream.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/deps/streamsearch/sbmh.js +241 -0
- package/lib/esm/__/@fastify/busboy/deps/streamsearch/sbmh.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/main.js +102 -0
- package/lib/esm/__/@fastify/busboy/lib/main.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/types/multipart.js +324 -0
- package/lib/esm/__/@fastify/busboy/lib/types/multipart.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/types/urlencoded.js +204 -0
- package/lib/esm/__/@fastify/busboy/lib/types/urlencoded.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/Decoder.js +64 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/Decoder.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/basename.js +24 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/basename.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/decodeText.js +124 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/decodeText.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/getLimit.js +26 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/getLimit.js.map +1 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/parseParams.js +209 -0
- package/lib/esm/__/@fastify/busboy/lib/utils/parseParams.js.map +1 -0
- package/lib/esm/__/cross-spawn/index.js +1 -1
- package/lib/esm/__/env-ci/__/execa/index.js +1 -1
- package/lib/esm/__/env-ci/__/execa/lib/stream.js +1 -1
- package/lib/esm/__/fast-content-type-parse/index.js +180 -0
- package/lib/esm/__/fast-content-type-parse/index.js.map +1 -0
- package/lib/esm/__/java-properties/dist-node/index.js +1 -1
- package/lib/esm/__/path-key/index.js +1 -1
- package/lib/esm/__/tunnel/index.js +14 -0
- package/lib/esm/__/tunnel/index.js.map +1 -0
- package/lib/esm/__/tunnel/lib/tunnel.js +279 -0
- package/lib/esm/__/tunnel/lib/tunnel.js.map +1 -0
- package/lib/esm/__/undici/index.js +210 -0
- package/lib/esm/__/undici/index.js.map +1 -0
- package/lib/esm/__/undici/lib/agent.js +167 -0
- package/lib/esm/__/undici/lib/agent.js.map +1 -0
- package/lib/esm/__/undici/lib/api/abort-signal.js +68 -0
- package/lib/esm/__/undici/lib/api/abort-signal.js.map +1 -0
- package/lib/esm/__/undici/lib/api/api-connect.js +119 -0
- package/lib/esm/__/undici/lib/api/api-connect.js.map +1 -0
- package/lib/esm/__/undici/lib/api/api-pipeline.js +266 -0
- package/lib/esm/__/undici/lib/api/api-pipeline.js.map +1 -0
- package/lib/esm/__/undici/lib/api/api-request.js +197 -0
- package/lib/esm/__/undici/lib/api/api-request.js.map +1 -0
- package/lib/esm/__/undici/lib/api/api-stream.js +237 -0
- package/lib/esm/__/undici/lib/api/api-stream.js.map +1 -0
- package/lib/esm/__/undici/lib/api/api-upgrade.js +121 -0
- package/lib/esm/__/undici/lib/api/api-upgrade.js.map +1 -0
- package/lib/esm/__/undici/lib/api/index.js +23 -0
- package/lib/esm/__/undici/lib/api/index.js.map +1 -0
- package/lib/esm/__/undici/lib/api/readable.js +335 -0
- package/lib/esm/__/undici/lib/api/readable.js.map +1 -0
- package/lib/esm/__/undici/lib/api/util.js +61 -0
- package/lib/esm/__/undici/lib/api/util.js.map +1 -0
- package/lib/esm/__/undici/lib/balanced-pool.js +206 -0
- package/lib/esm/__/undici/lib/balanced-pool.js.map +1 -0
- package/lib/esm/__/undici/lib/cache/cache.js +861 -0
- package/lib/esm/__/undici/lib/cache/cache.js.map +1 -0
- package/lib/esm/__/undici/lib/cache/cachestorage.js +159 -0
- package/lib/esm/__/undici/lib/cache/cachestorage.js.map +1 -0
- package/lib/esm/__/undici/lib/cache/symbols.js +17 -0
- package/lib/esm/__/undici/lib/cache/symbols.js.map +1 -0
- package/lib/esm/__/undici/lib/cache/util.js +63 -0
- package/lib/esm/__/undici/lib/cache/util.js.map +1 -0
- package/lib/esm/__/undici/lib/client.js +2305 -0
- package/lib/esm/__/undici/lib/client.js.map +1 -0
- package/lib/esm/__/undici/lib/compat/dispatcher-weakref.js +61 -0
- package/lib/esm/__/undici/lib/compat/dispatcher-weakref.js.map +1 -0
- package/lib/esm/__/undici/lib/cookies/constants.js +22 -0
- package/lib/esm/__/undici/lib/cookies/constants.js.map +1 -0
- package/lib/esm/__/undici/lib/cookies/index.js +198 -0
- package/lib/esm/__/undici/lib/cookies/index.js.map +1 -0
- package/lib/esm/__/undici/lib/cookies/parse.js +332 -0
- package/lib/esm/__/undici/lib/cookies/parse.js.map +1 -0
- package/lib/esm/__/undici/lib/cookies/util.js +284 -0
- package/lib/esm/__/undici/lib/cookies/util.js.map +1 -0
- package/lib/esm/__/undici/lib/core/connect.js +206 -0
- package/lib/esm/__/undici/lib/core/connect.js.map +1 -0
- package/lib/esm/__/undici/lib/core/constants.js +128 -0
- package/lib/esm/__/undici/lib/core/constants.js.map +1 -0
- package/lib/esm/__/undici/lib/core/errors.js +240 -0
- package/lib/esm/__/undici/lib/core/errors.js.map +1 -0
- package/lib/esm/__/undici/lib/core/request.js +515 -0
- package/lib/esm/__/undici/lib/core/request.js.map +1 -0
- package/lib/esm/__/undici/lib/core/symbols.js +74 -0
- package/lib/esm/__/undici/lib/core/symbols.js.map +1 -0
- package/lib/esm/__/undici/lib/core/util.js +544 -0
- package/lib/esm/__/undici/lib/core/util.js.map +1 -0
- package/lib/esm/__/undici/lib/dispatcher-base.js +206 -0
- package/lib/esm/__/undici/lib/dispatcher-base.js.map +1 -0
- package/lib/esm/__/undici/lib/dispatcher.js +31 -0
- package/lib/esm/__/undici/lib/dispatcher.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/body.js +638 -0
- package/lib/esm/__/undici/lib/fetch/body.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/constants.js +163 -0
- package/lib/esm/__/undici/lib/fetch/constants.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/dataURL.js +642 -0
- package/lib/esm/__/undici/lib/fetch/dataURL.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/file.js +362 -0
- package/lib/esm/__/undici/lib/fetch/file.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/formdata.js +281 -0
- package/lib/esm/__/undici/lib/fetch/formdata.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/global.js +50 -0
- package/lib/esm/__/undici/lib/fetch/global.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/headers.js +602 -0
- package/lib/esm/__/undici/lib/fetch/headers.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/index.js +2102 -0
- package/lib/esm/__/undici/lib/fetch/index.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/request.js +971 -0
- package/lib/esm/__/undici/lib/fetch/request.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/response.js +596 -0
- package/lib/esm/__/undici/lib/fetch/response.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/symbols.js +20 -0
- package/lib/esm/__/undici/lib/fetch/symbols.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/util.js +1161 -0
- package/lib/esm/__/undici/lib/fetch/util.js.map +1 -0
- package/lib/esm/__/undici/lib/fetch/webidl.js +659 -0
- package/lib/esm/__/undici/lib/fetch/webidl.js.map +1 -0
- package/lib/esm/__/undici/lib/fileapi/encoding.js +300 -0
- package/lib/esm/__/undici/lib/fileapi/encoding.js.map +1 -0
- package/lib/esm/__/undici/lib/fileapi/filereader.js +359 -0
- package/lib/esm/__/undici/lib/fileapi/filereader.js.map +1 -0
- package/lib/esm/__/undici/lib/fileapi/progressevent.js +90 -0
- package/lib/esm/__/undici/lib/fileapi/progressevent.js.map +1 -0
- package/lib/esm/__/undici/lib/fileapi/symbols.js +20 -0
- package/lib/esm/__/undici/lib/fileapi/symbols.js.map +1 -0
- package/lib/esm/__/undici/lib/fileapi/util.js +411 -0
- package/lib/esm/__/undici/lib/fileapi/util.js.map +1 -0
- package/lib/esm/__/undici/lib/global.js +45 -0
- package/lib/esm/__/undici/lib/global.js.map +1 -0
- package/lib/esm/__/undici/lib/handler/DecoratorHandler.js +45 -0
- package/lib/esm/__/undici/lib/handler/DecoratorHandler.js.map +1 -0
- package/lib/esm/__/undici/lib/handler/RedirectHandler.js +219 -0
- package/lib/esm/__/undici/lib/handler/RedirectHandler.js.map +1 -0
- package/lib/esm/__/undici/lib/handler/RetryHandler.js +352 -0
- package/lib/esm/__/undici/lib/handler/RetryHandler.js.map +1 -0
- package/lib/esm/__/undici/lib/interceptor/redirectInterceptor.js +33 -0
- package/lib/esm/__/undici/lib/interceptor/redirectInterceptor.js.map +1 -0
- package/lib/esm/__/undici/lib/llhttp/constants.js +286 -0
- package/lib/esm/__/undici/lib/llhttp/constants.js.map +1 -0
- package/lib/esm/__/undici/lib/llhttp/llhttp-wasm.js +12 -0
- package/lib/esm/__/undici/lib/llhttp/llhttp-wasm.js.map +1 -0
- package/lib/esm/__/undici/lib/llhttp/llhttp_simd-wasm.js +12 -0
- package/lib/esm/__/undici/lib/llhttp/llhttp_simd-wasm.js.map +1 -0
- package/lib/esm/__/undici/lib/llhttp/utils.js +26 -0
- package/lib/esm/__/undici/lib/llhttp/utils.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-agent.js +192 -0
- package/lib/esm/__/undici/lib/mock/mock-agent.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-client.js +77 -0
- package/lib/esm/__/undici/lib/mock/mock-client.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-errors.js +29 -0
- package/lib/esm/__/undici/lib/mock/mock-errors.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-interceptor.js +221 -0
- package/lib/esm/__/undici/lib/mock/mock-interceptor.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-pool.js +77 -0
- package/lib/esm/__/undici/lib/mock/mock-pool.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-symbols.js +33 -0
- package/lib/esm/__/undici/lib/mock/mock-symbols.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/mock-utils.js +367 -0
- package/lib/esm/__/undici/lib/mock/mock-utils.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/pending-interceptors-formatter.js +53 -0
- package/lib/esm/__/undici/lib/mock/pending-interceptors-formatter.js.map +1 -0
- package/lib/esm/__/undici/lib/mock/pluralizer.js +39 -0
- package/lib/esm/__/undici/lib/mock/pluralizer.js.map +1 -0
- package/lib/esm/__/undici/lib/node/fixed-queue.js +127 -0
- package/lib/esm/__/undici/lib/node/fixed-queue.js.map +1 -0
- package/lib/esm/__/undici/lib/pool-base.js +209 -0
- package/lib/esm/__/undici/lib/pool-base.js.map +1 -0
- package/lib/esm/__/undici/lib/pool-stats.js +47 -0
- package/lib/esm/__/undici/lib/pool-stats.js.map +1 -0
- package/lib/esm/__/undici/lib/pool.js +125 -0
- package/lib/esm/__/undici/lib/pool.js.map +1 -0
- package/lib/esm/__/undici/lib/proxy-agent.js +207 -0
- package/lib/esm/__/undici/lib/proxy-agent.js.map +1 -0
- package/lib/esm/__/undici/lib/timers.js +107 -0
- package/lib/esm/__/undici/lib/timers.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/connection.js +312 -0
- package/lib/esm/__/undici/lib/websocket/connection.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/constants.js +61 -0
- package/lib/esm/__/undici/lib/websocket/constants.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/events.js +317 -0
- package/lib/esm/__/undici/lib/websocket/events.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/frame.js +85 -0
- package/lib/esm/__/undici/lib/websocket/frame.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/receiver.js +361 -0
- package/lib/esm/__/undici/lib/websocket/receiver.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/symbols.js +22 -0
- package/lib/esm/__/undici/lib/websocket/symbols.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/util.js +214 -0
- package/lib/esm/__/undici/lib/websocket/util.js.map +1 -0
- package/lib/esm/__/undici/lib/websocket/websocket.js +662 -0
- package/lib/esm/__/undici/lib/websocket/websocket.js.map +1 -0
- package/lib/esm/_virtual/_commonjsHelpers.js +30 -1
- package/lib/esm/_virtual/_commonjsHelpers.js.map +1 -1
- package/lib/esm/_virtual/api-request.js +4 -0
- package/lib/esm/_virtual/api-request.js.map +1 -0
- package/lib/esm/_virtual/constants.js +4 -0
- package/lib/esm/_virtual/constants.js.map +1 -0
- package/lib/esm/_virtual/context.js +4 -0
- package/lib/esm/_virtual/context.js.map +1 -0
- package/lib/esm/_virtual/github.js +6 -0
- package/lib/esm/_virtual/github.js.map +1 -0
- package/lib/esm/_virtual/github2.js +4 -0
- package/lib/esm/_virtual/github2.js.map +1 -0
- package/lib/esm/_virtual/index10.js +4 -0
- package/lib/esm/_virtual/index10.js.map +1 -0
- package/lib/esm/_virtual/index11.js +4 -0
- package/lib/esm/_virtual/index11.js.map +1 -0
- package/lib/esm/_virtual/index12.js +4 -0
- package/lib/esm/_virtual/index12.js.map +1 -0
- package/lib/esm/_virtual/index13.js +4 -0
- package/lib/esm/_virtual/index13.js.map +1 -0
- package/lib/esm/_virtual/index14.js +4 -0
- package/lib/esm/_virtual/index14.js.map +1 -0
- package/lib/esm/_virtual/index2.js +4 -5
- package/lib/esm/_virtual/index2.js.map +1 -1
- package/lib/esm/_virtual/index3.js +5 -2
- package/lib/esm/_virtual/index3.js.map +1 -1
- package/lib/esm/_virtual/index4.js +5 -2
- package/lib/esm/_virtual/index4.js.map +1 -1
- package/lib/esm/_virtual/index5.js +2 -2
- package/lib/esm/_virtual/index6.js +6 -2
- package/lib/esm/_virtual/index6.js.map +1 -1
- package/lib/esm/_virtual/index7.js +4 -0
- package/lib/esm/_virtual/index7.js.map +1 -0
- package/lib/esm/_virtual/index8.js +6 -0
- package/lib/esm/_virtual/index8.js.map +1 -0
- package/lib/esm/_virtual/index9.js +4 -0
- package/lib/esm/_virtual/index9.js.map +1 -0
- package/lib/esm/_virtual/main.js +4 -0
- package/lib/esm/_virtual/main.js.map +1 -0
- package/lib/esm/_virtual/mock-interceptor.js +4 -0
- package/lib/esm/_virtual/mock-interceptor.js.map +1 -0
- package/lib/esm/_virtual/proxy.js +4 -0
- package/lib/esm/_virtual/proxy.js.map +1 -0
- package/lib/esm/_virtual/tunnel.js +4 -0
- package/lib/esm/_virtual/tunnel.js.map +1 -0
- package/lib/esm/_virtual/utils.js +4 -0
- package/lib/esm/_virtual/utils.js.map +1 -0
- package/lib/esm/_virtual/utils2.js +4 -0
- package/lib/esm/_virtual/utils2.js.map +1 -0
- package/lib/esm/_virtual/utils3.js +4 -0
- package/lib/esm/_virtual/utils3.js.map +1 -0
- package/lib/esm/artifacts/filter-artifacts.js.map +1 -1
- package/lib/esm/env/ci-env.js +6 -1
- package/lib/esm/env/ci-env.js.map +1 -1
- package/lib/esm/env/load.js +1 -1
- package/lib/esm/env/load.js.map +1 -1
- package/lib/esm/env/service/github.js +3 -3
- package/lib/esm/env/service/github.js.map +1 -1
- package/lib/esm/ingest/ingest.js +1 -1
- package/lib/esm/ingest/ingest.js.map +1 -1
- package/lib/esm/locales/en.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,2114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var response = require('./response.js');
|
|
4
|
+
var headers = require('./headers.js');
|
|
5
|
+
var request = require('./request.js');
|
|
6
|
+
var require$$3 = require('node:zlib');
|
|
7
|
+
var util = require('./util.js');
|
|
8
|
+
var symbols = require('./symbols.js');
|
|
9
|
+
var require$$0$1 = require('node:assert');
|
|
10
|
+
var body = require('./body.js');
|
|
11
|
+
var constants = require('./constants.js');
|
|
12
|
+
var symbols$1 = require('../core/symbols.js');
|
|
13
|
+
var require$$0$2 = require('node:events');
|
|
14
|
+
var require$$0 = require('node:stream');
|
|
15
|
+
var util$1 = require('../core/util.js');
|
|
16
|
+
var dataURL = require('./dataURL.js');
|
|
17
|
+
var require$$14 = require('node:stream/web');
|
|
18
|
+
var global = require('../global.js');
|
|
19
|
+
var webidl = require('./webidl.js');
|
|
20
|
+
var require$$2 = require('node:http');
|
|
21
|
+
var require$$7 = require('node:buffer');
|
|
22
|
+
|
|
23
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
+
|
|
25
|
+
var require$$3__default = /*#__PURE__*/_interopDefault(require$$3);
|
|
26
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefault(require$$0$1);
|
|
27
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefault(require$$0$2);
|
|
28
|
+
var require$$0__default = /*#__PURE__*/_interopDefault(require$$0);
|
|
29
|
+
var require$$14__default = /*#__PURE__*/_interopDefault(require$$14);
|
|
30
|
+
var require$$2__default = /*#__PURE__*/_interopDefault(require$$2);
|
|
31
|
+
var require$$7__default = /*#__PURE__*/_interopDefault(require$$7);
|
|
32
|
+
|
|
33
|
+
var fetch_1;
|
|
34
|
+
var hasRequiredFetch;
|
|
35
|
+
|
|
36
|
+
function requireFetch () {
|
|
37
|
+
if (hasRequiredFetch) return fetch_1;
|
|
38
|
+
hasRequiredFetch = 1;
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
Response,
|
|
42
|
+
makeNetworkError,
|
|
43
|
+
makeAppropriateNetworkError,
|
|
44
|
+
filterResponse,
|
|
45
|
+
makeResponse
|
|
46
|
+
} = response.__require();
|
|
47
|
+
const { Headers } = headers.__require();
|
|
48
|
+
const { Request, makeRequest } = request.__require();
|
|
49
|
+
const zlib = require$$3__default.default;
|
|
50
|
+
const {
|
|
51
|
+
bytesMatch,
|
|
52
|
+
makePolicyContainer,
|
|
53
|
+
clonePolicyContainer,
|
|
54
|
+
requestBadPort,
|
|
55
|
+
TAOCheck,
|
|
56
|
+
appendRequestOriginHeader,
|
|
57
|
+
responseLocationURL,
|
|
58
|
+
requestCurrentURL,
|
|
59
|
+
setRequestReferrerPolicyOnRedirect,
|
|
60
|
+
tryUpgradeRequestToAPotentiallyTrustworthyURL,
|
|
61
|
+
createOpaqueTimingInfo,
|
|
62
|
+
appendFetchMetadata,
|
|
63
|
+
corsCheck,
|
|
64
|
+
crossOriginResourcePolicyCheck,
|
|
65
|
+
determineRequestsReferrer,
|
|
66
|
+
coarsenedSharedCurrentTime,
|
|
67
|
+
createDeferredPromise,
|
|
68
|
+
isBlobLike,
|
|
69
|
+
sameOrigin,
|
|
70
|
+
isCancelled,
|
|
71
|
+
isAborted,
|
|
72
|
+
isErrorLike,
|
|
73
|
+
fullyReadBody,
|
|
74
|
+
readableStreamClose,
|
|
75
|
+
isomorphicEncode,
|
|
76
|
+
urlIsLocal,
|
|
77
|
+
urlIsHttpHttpsScheme,
|
|
78
|
+
urlHasHttpsScheme
|
|
79
|
+
} = util.__require();
|
|
80
|
+
const { kState, kHeaders, kGuard, kRealm } = symbols.__require();
|
|
81
|
+
const assert = require$$0__default$1.default;
|
|
82
|
+
const { safelyExtractBody } = body.__require();
|
|
83
|
+
const {
|
|
84
|
+
redirectStatusSet,
|
|
85
|
+
nullBodyStatus,
|
|
86
|
+
safeMethodsSet,
|
|
87
|
+
requestBodyHeader,
|
|
88
|
+
subresourceSet,
|
|
89
|
+
DOMException
|
|
90
|
+
} = constants.__require();
|
|
91
|
+
const { kHeadersList } = symbols$1.__require();
|
|
92
|
+
const EE = require$$0__default$2.default;
|
|
93
|
+
const { Readable, pipeline } = require$$0__default.default;
|
|
94
|
+
const { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = util$1.__require();
|
|
95
|
+
const { dataURLProcessor, serializeAMimeType } = dataURL.__require();
|
|
96
|
+
const { TransformStream } = require$$14__default.default;
|
|
97
|
+
const { getGlobalDispatcher } = global.__require();
|
|
98
|
+
const { webidl: webidl$1 } = webidl.__require();
|
|
99
|
+
const { STATUS_CODES } = require$$2__default.default;
|
|
100
|
+
const GET_OR_HEAD = ['GET', 'HEAD'];
|
|
101
|
+
|
|
102
|
+
/** @type {import('buffer').resolveObjectURL} */
|
|
103
|
+
let resolveObjectURL;
|
|
104
|
+
let ReadableStream = globalThis.ReadableStream;
|
|
105
|
+
|
|
106
|
+
class Fetch extends EE {
|
|
107
|
+
constructor (dispatcher) {
|
|
108
|
+
super();
|
|
109
|
+
|
|
110
|
+
this.dispatcher = dispatcher;
|
|
111
|
+
this.connection = null;
|
|
112
|
+
this.dump = false;
|
|
113
|
+
this.state = 'ongoing';
|
|
114
|
+
// 2 terminated listeners get added per request,
|
|
115
|
+
// but only 1 gets removed. If there are 20 redirects,
|
|
116
|
+
// 21 listeners will be added.
|
|
117
|
+
// See https://github.com/nodejs/undici/issues/1711
|
|
118
|
+
// TODO (fix): Find and fix root cause for leaked listener.
|
|
119
|
+
this.setMaxListeners(21);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
terminate (reason) {
|
|
123
|
+
if (this.state !== 'ongoing') {
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
this.state = 'terminated';
|
|
128
|
+
this.connection?.destroy(reason);
|
|
129
|
+
this.emit('terminated', reason);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// https://fetch.spec.whatwg.org/#fetch-controller-abort
|
|
133
|
+
abort (error) {
|
|
134
|
+
if (this.state !== 'ongoing') {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 1. Set controller’s state to "aborted".
|
|
139
|
+
this.state = 'aborted';
|
|
140
|
+
|
|
141
|
+
// 2. Let fallbackError be an "AbortError" DOMException.
|
|
142
|
+
// 3. Set error to fallbackError if it is not given.
|
|
143
|
+
if (!error) {
|
|
144
|
+
error = new DOMException('The operation was aborted.', 'AbortError');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// 4. Let serializedError be StructuredSerialize(error).
|
|
148
|
+
// If that threw an exception, catch it, and let
|
|
149
|
+
// serializedError be StructuredSerialize(fallbackError).
|
|
150
|
+
|
|
151
|
+
// 5. Set controller’s serialized abort reason to serializedError.
|
|
152
|
+
this.serializedAbortReason = error;
|
|
153
|
+
|
|
154
|
+
this.connection?.destroy(error);
|
|
155
|
+
this.emit('terminated', error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// https://fetch.spec.whatwg.org/#fetch-method
|
|
160
|
+
function fetch (input, init = {}) {
|
|
161
|
+
webidl$1.argumentLengthCheck(arguments, 1, { header: 'globalThis.fetch' });
|
|
162
|
+
|
|
163
|
+
// 1. Let p be a new promise.
|
|
164
|
+
const p = createDeferredPromise();
|
|
165
|
+
|
|
166
|
+
// 2. Let requestObject be the result of invoking the initial value of
|
|
167
|
+
// Request as constructor with input and init as arguments. If this throws
|
|
168
|
+
// an exception, reject p with it and return p.
|
|
169
|
+
let requestObject;
|
|
170
|
+
|
|
171
|
+
try {
|
|
172
|
+
requestObject = new Request(input, init);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
p.reject(e);
|
|
175
|
+
return p.promise
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 3. Let request be requestObject’s request.
|
|
179
|
+
const request = requestObject[kState];
|
|
180
|
+
|
|
181
|
+
// 4. If requestObject’s signal’s aborted flag is set, then:
|
|
182
|
+
if (requestObject.signal.aborted) {
|
|
183
|
+
// 1. Abort the fetch() call with p, request, null, and
|
|
184
|
+
// requestObject’s signal’s abort reason.
|
|
185
|
+
abortFetch(p, request, null, requestObject.signal.reason);
|
|
186
|
+
|
|
187
|
+
// 2. Return p.
|
|
188
|
+
return p.promise
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 5. Let globalObject be request’s client’s global object.
|
|
192
|
+
const globalObject = request.client.globalObject;
|
|
193
|
+
|
|
194
|
+
// 6. If globalObject is a ServiceWorkerGlobalScope object, then set
|
|
195
|
+
// request’s service-workers mode to "none".
|
|
196
|
+
if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') {
|
|
197
|
+
request.serviceWorkers = 'none';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// 7. Let responseObject be null.
|
|
201
|
+
let responseObject = null;
|
|
202
|
+
|
|
203
|
+
// 8. Let relevantRealm be this’s relevant Realm.
|
|
204
|
+
const relevantRealm = null;
|
|
205
|
+
|
|
206
|
+
// 9. Let locallyAborted be false.
|
|
207
|
+
let locallyAborted = false;
|
|
208
|
+
|
|
209
|
+
// 10. Let controller be null.
|
|
210
|
+
let controller = null;
|
|
211
|
+
|
|
212
|
+
// 11. Add the following abort steps to requestObject’s signal:
|
|
213
|
+
addAbortListener(
|
|
214
|
+
requestObject.signal,
|
|
215
|
+
() => {
|
|
216
|
+
// 1. Set locallyAborted to true.
|
|
217
|
+
locallyAborted = true;
|
|
218
|
+
|
|
219
|
+
// 2. Assert: controller is non-null.
|
|
220
|
+
assert(controller != null);
|
|
221
|
+
|
|
222
|
+
// 3. Abort controller with requestObject’s signal’s abort reason.
|
|
223
|
+
controller.abort(requestObject.signal.reason);
|
|
224
|
+
|
|
225
|
+
// 4. Abort the fetch() call with p, request, responseObject,
|
|
226
|
+
// and requestObject’s signal’s abort reason.
|
|
227
|
+
abortFetch(p, request, responseObject, requestObject.signal.reason);
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
// 12. Let handleFetchDone given response response be to finalize and
|
|
232
|
+
// report timing with response, globalObject, and "fetch".
|
|
233
|
+
const handleFetchDone = (response) =>
|
|
234
|
+
finalizeAndReportTiming(response, 'fetch');
|
|
235
|
+
|
|
236
|
+
// 13. Set controller to the result of calling fetch given request,
|
|
237
|
+
// with processResponseEndOfBody set to handleFetchDone, and processResponse
|
|
238
|
+
// given response being these substeps:
|
|
239
|
+
|
|
240
|
+
const processResponse = (response) => {
|
|
241
|
+
// 1. If locallyAborted is true, terminate these substeps.
|
|
242
|
+
if (locallyAborted) {
|
|
243
|
+
return Promise.resolve()
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// 2. If response’s aborted flag is set, then:
|
|
247
|
+
if (response.aborted) {
|
|
248
|
+
// 1. Let deserializedError be the result of deserialize a serialized
|
|
249
|
+
// abort reason given controller’s serialized abort reason and
|
|
250
|
+
// relevantRealm.
|
|
251
|
+
|
|
252
|
+
// 2. Abort the fetch() call with p, request, responseObject, and
|
|
253
|
+
// deserializedError.
|
|
254
|
+
|
|
255
|
+
abortFetch(p, request, responseObject, controller.serializedAbortReason);
|
|
256
|
+
return Promise.resolve()
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 3. If response is a network error, then reject p with a TypeError
|
|
260
|
+
// and terminate these substeps.
|
|
261
|
+
if (response.type === 'error') {
|
|
262
|
+
p.reject(
|
|
263
|
+
Object.assign(new TypeError('fetch failed'), { cause: response.error })
|
|
264
|
+
);
|
|
265
|
+
return Promise.resolve()
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 4. Set responseObject to the result of creating a Response object,
|
|
269
|
+
// given response, "immutable", and relevantRealm.
|
|
270
|
+
responseObject = new Response();
|
|
271
|
+
responseObject[kState] = response;
|
|
272
|
+
responseObject[kRealm] = relevantRealm;
|
|
273
|
+
responseObject[kHeaders][kHeadersList] = response.headersList;
|
|
274
|
+
responseObject[kHeaders][kGuard] = 'immutable';
|
|
275
|
+
responseObject[kHeaders][kRealm] = relevantRealm;
|
|
276
|
+
|
|
277
|
+
// 5. Resolve p with responseObject.
|
|
278
|
+
p.resolve(responseObject);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
controller = fetching({
|
|
282
|
+
request,
|
|
283
|
+
processResponseEndOfBody: handleFetchDone,
|
|
284
|
+
processResponse,
|
|
285
|
+
dispatcher: init.dispatcher ?? getGlobalDispatcher() // undici
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// 14. Return p.
|
|
289
|
+
return p.promise
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// https://fetch.spec.whatwg.org/#finalize-and-report-timing
|
|
293
|
+
function finalizeAndReportTiming (response, initiatorType = 'other') {
|
|
294
|
+
// 1. If response is an aborted network error, then return.
|
|
295
|
+
if (response.type === 'error' && response.aborted) {
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// 2. If response’s URL list is null or empty, then return.
|
|
300
|
+
if (!response.urlList?.length) {
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// 3. Let originalURL be response’s URL list[0].
|
|
305
|
+
const originalURL = response.urlList[0];
|
|
306
|
+
|
|
307
|
+
// 4. Let timingInfo be response’s timing info.
|
|
308
|
+
let timingInfo = response.timingInfo;
|
|
309
|
+
|
|
310
|
+
// 5. Let cacheState be response’s cache state.
|
|
311
|
+
let cacheState = response.cacheState;
|
|
312
|
+
|
|
313
|
+
// 6. If originalURL’s scheme is not an HTTP(S) scheme, then return.
|
|
314
|
+
if (!urlIsHttpHttpsScheme(originalURL)) {
|
|
315
|
+
return
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// 7. If timingInfo is null, then return.
|
|
319
|
+
if (timingInfo === null) {
|
|
320
|
+
return
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// 8. If response’s timing allow passed flag is not set, then:
|
|
324
|
+
if (!response.timingAllowPassed) {
|
|
325
|
+
// 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo.
|
|
326
|
+
timingInfo = createOpaqueTimingInfo({
|
|
327
|
+
startTime: timingInfo.startTime
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
// 2. Set cacheState to the empty string.
|
|
331
|
+
cacheState = '';
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// 9. Set timingInfo’s end time to the coarsened shared current time
|
|
335
|
+
// given global’s relevant settings object’s cross-origin isolated
|
|
336
|
+
// capability.
|
|
337
|
+
// TODO: given global’s relevant settings object’s cross-origin isolated
|
|
338
|
+
// capability?
|
|
339
|
+
timingInfo.endTime = coarsenedSharedCurrentTime();
|
|
340
|
+
|
|
341
|
+
// 10. Set response’s timing info to timingInfo.
|
|
342
|
+
response.timingInfo = timingInfo;
|
|
343
|
+
|
|
344
|
+
// 11. Mark resource timing for timingInfo, originalURL, initiatorType,
|
|
345
|
+
// global, and cacheState.
|
|
346
|
+
markResourceTiming(
|
|
347
|
+
timingInfo,
|
|
348
|
+
originalURL,
|
|
349
|
+
initiatorType,
|
|
350
|
+
globalThis,
|
|
351
|
+
cacheState
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// https://w3c.github.io/resource-timing/#dfn-mark-resource-timing
|
|
356
|
+
function markResourceTiming (timingInfo, originalURL, initiatorType, globalThis, cacheState) {
|
|
357
|
+
if (nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 2)) {
|
|
358
|
+
performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis, cacheState);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// https://fetch.spec.whatwg.org/#abort-fetch
|
|
363
|
+
function abortFetch (p, request, responseObject, error) {
|
|
364
|
+
// Note: AbortSignal.reason was added in node v17.2.0
|
|
365
|
+
// which would give us an undefined error to reject with.
|
|
366
|
+
// Remove this once node v16 is no longer supported.
|
|
367
|
+
if (!error) {
|
|
368
|
+
error = new DOMException('The operation was aborted.', 'AbortError');
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// 1. Reject promise with error.
|
|
372
|
+
p.reject(error);
|
|
373
|
+
|
|
374
|
+
// 2. If request’s body is not null and is readable, then cancel request’s
|
|
375
|
+
// body with error.
|
|
376
|
+
if (request.body != null && isReadable(request.body?.stream)) {
|
|
377
|
+
request.body.stream.cancel(error).catch((err) => {
|
|
378
|
+
if (err.code === 'ERR_INVALID_STATE') {
|
|
379
|
+
// Node bug?
|
|
380
|
+
return
|
|
381
|
+
}
|
|
382
|
+
throw err
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// 3. If responseObject is null, then return.
|
|
387
|
+
if (responseObject == null) {
|
|
388
|
+
return
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// 4. Let response be responseObject’s response.
|
|
392
|
+
const response = responseObject[kState];
|
|
393
|
+
|
|
394
|
+
// 5. If response’s body is not null and is readable, then error response’s
|
|
395
|
+
// body with error.
|
|
396
|
+
if (response.body != null && isReadable(response.body?.stream)) {
|
|
397
|
+
response.body.stream.cancel(error).catch((err) => {
|
|
398
|
+
if (err.code === 'ERR_INVALID_STATE') {
|
|
399
|
+
// Node bug?
|
|
400
|
+
return
|
|
401
|
+
}
|
|
402
|
+
throw err
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// https://fetch.spec.whatwg.org/#fetching
|
|
408
|
+
function fetching ({
|
|
409
|
+
request,
|
|
410
|
+
processRequestBodyChunkLength,
|
|
411
|
+
processRequestEndOfBody,
|
|
412
|
+
processResponse,
|
|
413
|
+
processResponseEndOfBody,
|
|
414
|
+
processResponseConsumeBody,
|
|
415
|
+
useParallelQueue = false,
|
|
416
|
+
dispatcher // undici
|
|
417
|
+
}) {
|
|
418
|
+
// 1. Let taskDestination be null.
|
|
419
|
+
let taskDestination = null;
|
|
420
|
+
|
|
421
|
+
// 2. Let crossOriginIsolatedCapability be false.
|
|
422
|
+
let crossOriginIsolatedCapability = false;
|
|
423
|
+
|
|
424
|
+
// 3. If request’s client is non-null, then:
|
|
425
|
+
if (request.client != null) {
|
|
426
|
+
// 1. Set taskDestination to request’s client’s global object.
|
|
427
|
+
taskDestination = request.client.globalObject;
|
|
428
|
+
|
|
429
|
+
// 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin
|
|
430
|
+
// isolated capability.
|
|
431
|
+
crossOriginIsolatedCapability =
|
|
432
|
+
request.client.crossOriginIsolatedCapability;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// 4. If useParallelQueue is true, then set taskDestination to the result of
|
|
436
|
+
// starting a new parallel queue.
|
|
437
|
+
// TODO
|
|
438
|
+
|
|
439
|
+
// 5. Let timingInfo be a new fetch timing info whose start time and
|
|
440
|
+
// post-redirect start time are the coarsened shared current time given
|
|
441
|
+
// crossOriginIsolatedCapability.
|
|
442
|
+
const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability);
|
|
443
|
+
const timingInfo = createOpaqueTimingInfo({
|
|
444
|
+
startTime: currenTime
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
// 6. Let fetchParams be a new fetch params whose
|
|
448
|
+
// request is request,
|
|
449
|
+
// timing info is timingInfo,
|
|
450
|
+
// process request body chunk length is processRequestBodyChunkLength,
|
|
451
|
+
// process request end-of-body is processRequestEndOfBody,
|
|
452
|
+
// process response is processResponse,
|
|
453
|
+
// process response consume body is processResponseConsumeBody,
|
|
454
|
+
// process response end-of-body is processResponseEndOfBody,
|
|
455
|
+
// task destination is taskDestination,
|
|
456
|
+
// and cross-origin isolated capability is crossOriginIsolatedCapability.
|
|
457
|
+
const fetchParams = {
|
|
458
|
+
controller: new Fetch(dispatcher),
|
|
459
|
+
request,
|
|
460
|
+
timingInfo,
|
|
461
|
+
processRequestBodyChunkLength,
|
|
462
|
+
processRequestEndOfBody,
|
|
463
|
+
processResponse,
|
|
464
|
+
processResponseConsumeBody,
|
|
465
|
+
processResponseEndOfBody,
|
|
466
|
+
taskDestination,
|
|
467
|
+
crossOriginIsolatedCapability
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// 7. If request’s body is a byte sequence, then set request’s body to
|
|
471
|
+
// request’s body as a body.
|
|
472
|
+
// NOTE: Since fetching is only called from fetch, body should already be
|
|
473
|
+
// extracted.
|
|
474
|
+
assert(!request.body || request.body.stream);
|
|
475
|
+
|
|
476
|
+
// 8. If request’s window is "client", then set request’s window to request’s
|
|
477
|
+
// client, if request’s client’s global object is a Window object; otherwise
|
|
478
|
+
// "no-window".
|
|
479
|
+
if (request.window === 'client') {
|
|
480
|
+
// TODO: What if request.client is null?
|
|
481
|
+
request.window =
|
|
482
|
+
request.client?.globalObject?.constructor?.name === 'Window'
|
|
483
|
+
? request.client
|
|
484
|
+
: 'no-window';
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// 9. If request’s origin is "client", then set request’s origin to request’s
|
|
488
|
+
// client’s origin.
|
|
489
|
+
if (request.origin === 'client') {
|
|
490
|
+
// TODO: What if request.client is null?
|
|
491
|
+
request.origin = request.client?.origin;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// 10. If all of the following conditions are true:
|
|
495
|
+
// TODO
|
|
496
|
+
|
|
497
|
+
// 11. If request’s policy container is "client", then:
|
|
498
|
+
if (request.policyContainer === 'client') {
|
|
499
|
+
// 1. If request’s client is non-null, then set request’s policy
|
|
500
|
+
// container to a clone of request’s client’s policy container. [HTML]
|
|
501
|
+
if (request.client != null) {
|
|
502
|
+
request.policyContainer = clonePolicyContainer(
|
|
503
|
+
request.client.policyContainer
|
|
504
|
+
);
|
|
505
|
+
} else {
|
|
506
|
+
// 2. Otherwise, set request’s policy container to a new policy
|
|
507
|
+
// container.
|
|
508
|
+
request.policyContainer = makePolicyContainer();
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// 12. If request’s header list does not contain `Accept`, then:
|
|
513
|
+
if (!request.headersList.contains('accept')) {
|
|
514
|
+
// 1. Let value be `*/*`.
|
|
515
|
+
const value = '*/*';
|
|
516
|
+
|
|
517
|
+
// 2. A user agent should set value to the first matching statement, if
|
|
518
|
+
// any, switching on request’s destination:
|
|
519
|
+
// "document"
|
|
520
|
+
// "frame"
|
|
521
|
+
// "iframe"
|
|
522
|
+
// `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
|
|
523
|
+
// "image"
|
|
524
|
+
// `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5`
|
|
525
|
+
// "style"
|
|
526
|
+
// `text/css,*/*;q=0.1`
|
|
527
|
+
// TODO
|
|
528
|
+
|
|
529
|
+
// 3. Append `Accept`/value to request’s header list.
|
|
530
|
+
request.headersList.append('accept', value);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// 13. If request’s header list does not contain `Accept-Language`, then
|
|
534
|
+
// user agents should append `Accept-Language`/an appropriate value to
|
|
535
|
+
// request’s header list.
|
|
536
|
+
if (!request.headersList.contains('accept-language')) {
|
|
537
|
+
request.headersList.append('accept-language', '*');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// 14. If request’s priority is null, then use request’s initiator and
|
|
541
|
+
// destination appropriately in setting request’s priority to a
|
|
542
|
+
// user-agent-defined object.
|
|
543
|
+
if (request.priority === null) ;
|
|
544
|
+
|
|
545
|
+
// 15. If request is a subresource request, then:
|
|
546
|
+
if (subresourceSet.has(request.destination)) ;
|
|
547
|
+
|
|
548
|
+
// 16. Run main fetch given fetchParams.
|
|
549
|
+
mainFetch(fetchParams)
|
|
550
|
+
.catch(err => {
|
|
551
|
+
fetchParams.controller.terminate(err);
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
// 17. Return fetchParam's controller
|
|
555
|
+
return fetchParams.controller
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// https://fetch.spec.whatwg.org/#concept-main-fetch
|
|
559
|
+
async function mainFetch (fetchParams, recursive = false) {
|
|
560
|
+
// 1. Let request be fetchParams’s request.
|
|
561
|
+
const request = fetchParams.request;
|
|
562
|
+
|
|
563
|
+
// 2. Let response be null.
|
|
564
|
+
let response = null;
|
|
565
|
+
|
|
566
|
+
// 3. If request’s local-URLs-only flag is set and request’s current URL is
|
|
567
|
+
// not local, then set response to a network error.
|
|
568
|
+
if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) {
|
|
569
|
+
response = makeNetworkError('local URLs only');
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// 4. Run report Content Security Policy violations for request.
|
|
573
|
+
// TODO
|
|
574
|
+
|
|
575
|
+
// 5. Upgrade request to a potentially trustworthy URL, if appropriate.
|
|
576
|
+
tryUpgradeRequestToAPotentiallyTrustworthyURL(request);
|
|
577
|
+
|
|
578
|
+
// 6. If should request be blocked due to a bad port, should fetching request
|
|
579
|
+
// be blocked as mixed content, or should request be blocked by Content
|
|
580
|
+
// Security Policy returns blocked, then set response to a network error.
|
|
581
|
+
if (requestBadPort(request) === 'blocked') {
|
|
582
|
+
response = makeNetworkError('bad port');
|
|
583
|
+
}
|
|
584
|
+
// TODO: should fetching request be blocked as mixed content?
|
|
585
|
+
// TODO: should request be blocked by Content Security Policy?
|
|
586
|
+
|
|
587
|
+
// 7. If request’s referrer policy is the empty string, then set request’s
|
|
588
|
+
// referrer policy to request’s policy container’s referrer policy.
|
|
589
|
+
if (request.referrerPolicy === '') {
|
|
590
|
+
request.referrerPolicy = request.policyContainer.referrerPolicy;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// 8. If request’s referrer is not "no-referrer", then set request’s
|
|
594
|
+
// referrer to the result of invoking determine request’s referrer.
|
|
595
|
+
if (request.referrer !== 'no-referrer') {
|
|
596
|
+
request.referrer = determineRequestsReferrer(request);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// 9. Set request’s current URL’s scheme to "https" if all of the following
|
|
600
|
+
// conditions are true:
|
|
601
|
+
// - request’s current URL’s scheme is "http"
|
|
602
|
+
// - request’s current URL’s host is a domain
|
|
603
|
+
// - Matching request’s current URL’s host per Known HSTS Host Domain Name
|
|
604
|
+
// Matching results in either a superdomain match with an asserted
|
|
605
|
+
// includeSubDomains directive or a congruent match (with or without an
|
|
606
|
+
// asserted includeSubDomains directive). [HSTS]
|
|
607
|
+
// TODO
|
|
608
|
+
|
|
609
|
+
// 10. If recursive is false, then run the remaining steps in parallel.
|
|
610
|
+
// TODO
|
|
611
|
+
|
|
612
|
+
// 11. If response is null, then set response to the result of running
|
|
613
|
+
// the steps corresponding to the first matching statement:
|
|
614
|
+
if (response === null) {
|
|
615
|
+
response = await (async () => {
|
|
616
|
+
const currentURL = requestCurrentURL(request);
|
|
617
|
+
|
|
618
|
+
if (
|
|
619
|
+
// - request’s current URL’s origin is same origin with request’s origin,
|
|
620
|
+
// and request’s response tainting is "basic"
|
|
621
|
+
(sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') ||
|
|
622
|
+
// request’s current URL’s scheme is "data"
|
|
623
|
+
(currentURL.protocol === 'data:') ||
|
|
624
|
+
// - request’s mode is "navigate" or "websocket"
|
|
625
|
+
(request.mode === 'navigate' || request.mode === 'websocket')
|
|
626
|
+
) {
|
|
627
|
+
// 1. Set request’s response tainting to "basic".
|
|
628
|
+
request.responseTainting = 'basic';
|
|
629
|
+
|
|
630
|
+
// 2. Return the result of running scheme fetch given fetchParams.
|
|
631
|
+
return await schemeFetch(fetchParams)
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// request’s mode is "same-origin"
|
|
635
|
+
if (request.mode === 'same-origin') {
|
|
636
|
+
// 1. Return a network error.
|
|
637
|
+
return makeNetworkError('request mode cannot be "same-origin"')
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// request’s mode is "no-cors"
|
|
641
|
+
if (request.mode === 'no-cors') {
|
|
642
|
+
// 1. If request’s redirect mode is not "follow", then return a network
|
|
643
|
+
// error.
|
|
644
|
+
if (request.redirect !== 'follow') {
|
|
645
|
+
return makeNetworkError(
|
|
646
|
+
'redirect mode cannot be "follow" for "no-cors" request'
|
|
647
|
+
)
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// 2. Set request’s response tainting to "opaque".
|
|
651
|
+
request.responseTainting = 'opaque';
|
|
652
|
+
|
|
653
|
+
// 3. Return the result of running scheme fetch given fetchParams.
|
|
654
|
+
return await schemeFetch(fetchParams)
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// request’s current URL’s scheme is not an HTTP(S) scheme
|
|
658
|
+
if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) {
|
|
659
|
+
// Return a network error.
|
|
660
|
+
return makeNetworkError('URL scheme must be a HTTP(S) scheme')
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// - request’s use-CORS-preflight flag is set
|
|
664
|
+
// - request’s unsafe-request flag is set and either request’s method is
|
|
665
|
+
// not a CORS-safelisted method or CORS-unsafe request-header names with
|
|
666
|
+
// request’s header list is not empty
|
|
667
|
+
// 1. Set request’s response tainting to "cors".
|
|
668
|
+
// 2. Let corsWithPreflightResponse be the result of running HTTP fetch
|
|
669
|
+
// given fetchParams and true.
|
|
670
|
+
// 3. If corsWithPreflightResponse is a network error, then clear cache
|
|
671
|
+
// entries using request.
|
|
672
|
+
// 4. Return corsWithPreflightResponse.
|
|
673
|
+
// TODO
|
|
674
|
+
|
|
675
|
+
// Otherwise
|
|
676
|
+
// 1. Set request’s response tainting to "cors".
|
|
677
|
+
request.responseTainting = 'cors';
|
|
678
|
+
|
|
679
|
+
// 2. Return the result of running HTTP fetch given fetchParams.
|
|
680
|
+
return await httpFetch(fetchParams)
|
|
681
|
+
})();
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// 12. If recursive is true, then return response.
|
|
685
|
+
if (recursive) {
|
|
686
|
+
return response
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// 13. If response is not a network error and response is not a filtered
|
|
690
|
+
// response, then:
|
|
691
|
+
if (response.status !== 0 && !response.internalResponse) {
|
|
692
|
+
// If request’s response tainting is "cors", then:
|
|
693
|
+
if (request.responseTainting === 'cors') ;
|
|
694
|
+
|
|
695
|
+
// Set response to the following filtered response with response as its
|
|
696
|
+
// internal response, depending on request’s response tainting:
|
|
697
|
+
if (request.responseTainting === 'basic') {
|
|
698
|
+
response = filterResponse(response, 'basic');
|
|
699
|
+
} else if (request.responseTainting === 'cors') {
|
|
700
|
+
response = filterResponse(response, 'cors');
|
|
701
|
+
} else if (request.responseTainting === 'opaque') {
|
|
702
|
+
response = filterResponse(response, 'opaque');
|
|
703
|
+
} else {
|
|
704
|
+
assert(false);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// 14. Let internalResponse be response, if response is a network error,
|
|
709
|
+
// and response’s internal response otherwise.
|
|
710
|
+
let internalResponse =
|
|
711
|
+
response.status === 0 ? response : response.internalResponse;
|
|
712
|
+
|
|
713
|
+
// 15. If internalResponse’s URL list is empty, then set it to a clone of
|
|
714
|
+
// request’s URL list.
|
|
715
|
+
if (internalResponse.urlList.length === 0) {
|
|
716
|
+
internalResponse.urlList.push(...request.urlList);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// 16. If request’s timing allow failed flag is unset, then set
|
|
720
|
+
// internalResponse’s timing allow passed flag.
|
|
721
|
+
if (!request.timingAllowFailed) {
|
|
722
|
+
response.timingAllowPassed = true;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// 17. If response is not a network error and any of the following returns
|
|
726
|
+
// blocked
|
|
727
|
+
// - should internalResponse to request be blocked as mixed content
|
|
728
|
+
// - should internalResponse to request be blocked by Content Security Policy
|
|
729
|
+
// - should internalResponse to request be blocked due to its MIME type
|
|
730
|
+
// - should internalResponse to request be blocked due to nosniff
|
|
731
|
+
// TODO
|
|
732
|
+
|
|
733
|
+
// 18. If response’s type is "opaque", internalResponse’s status is 206,
|
|
734
|
+
// internalResponse’s range-requested flag is set, and request’s header
|
|
735
|
+
// list does not contain `Range`, then set response and internalResponse
|
|
736
|
+
// to a network error.
|
|
737
|
+
if (
|
|
738
|
+
response.type === 'opaque' &&
|
|
739
|
+
internalResponse.status === 206 &&
|
|
740
|
+
internalResponse.rangeRequested &&
|
|
741
|
+
!request.headers.contains('range')
|
|
742
|
+
) {
|
|
743
|
+
response = internalResponse = makeNetworkError();
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// 19. If response is not a network error and either request’s method is
|
|
747
|
+
// `HEAD` or `CONNECT`, or internalResponse’s status is a null body status,
|
|
748
|
+
// set internalResponse’s body to null and disregard any enqueuing toward
|
|
749
|
+
// it (if any).
|
|
750
|
+
if (
|
|
751
|
+
response.status !== 0 &&
|
|
752
|
+
(request.method === 'HEAD' ||
|
|
753
|
+
request.method === 'CONNECT' ||
|
|
754
|
+
nullBodyStatus.includes(internalResponse.status))
|
|
755
|
+
) {
|
|
756
|
+
internalResponse.body = null;
|
|
757
|
+
fetchParams.controller.dump = true;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// 20. If request’s integrity metadata is not the empty string, then:
|
|
761
|
+
if (request.integrity) {
|
|
762
|
+
// 1. Let processBodyError be this step: run fetch finale given fetchParams
|
|
763
|
+
// and a network error.
|
|
764
|
+
const processBodyError = (reason) =>
|
|
765
|
+
fetchFinale(fetchParams, makeNetworkError(reason));
|
|
766
|
+
|
|
767
|
+
// 2. If request’s response tainting is "opaque", or response’s body is null,
|
|
768
|
+
// then run processBodyError and abort these steps.
|
|
769
|
+
if (request.responseTainting === 'opaque' || response.body == null) {
|
|
770
|
+
processBodyError(response.error);
|
|
771
|
+
return
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// 3. Let processBody given bytes be these steps:
|
|
775
|
+
const processBody = (bytes) => {
|
|
776
|
+
// 1. If bytes do not match request’s integrity metadata,
|
|
777
|
+
// then run processBodyError and abort these steps. [SRI]
|
|
778
|
+
if (!bytesMatch(bytes, request.integrity)) {
|
|
779
|
+
processBodyError('integrity mismatch');
|
|
780
|
+
return
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// 2. Set response’s body to bytes as a body.
|
|
784
|
+
response.body = safelyExtractBody(bytes)[0];
|
|
785
|
+
|
|
786
|
+
// 3. Run fetch finale given fetchParams and response.
|
|
787
|
+
fetchFinale(fetchParams, response);
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
// 4. Fully read response’s body given processBody and processBodyError.
|
|
791
|
+
await fullyReadBody(response.body, processBody, processBodyError);
|
|
792
|
+
} else {
|
|
793
|
+
// 21. Otherwise, run fetch finale given fetchParams and response.
|
|
794
|
+
fetchFinale(fetchParams, response);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// https://fetch.spec.whatwg.org/#concept-scheme-fetch
|
|
799
|
+
// given a fetch params fetchParams
|
|
800
|
+
function schemeFetch (fetchParams) {
|
|
801
|
+
// Note: since the connection is destroyed on redirect, which sets fetchParams to a
|
|
802
|
+
// cancelled state, we do not want this condition to trigger *unless* there have been
|
|
803
|
+
// no redirects. See https://github.com/nodejs/undici/issues/1776
|
|
804
|
+
// 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
|
|
805
|
+
if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
|
|
806
|
+
return Promise.resolve(makeAppropriateNetworkError(fetchParams))
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// 2. Let request be fetchParams’s request.
|
|
810
|
+
const { request } = fetchParams;
|
|
811
|
+
|
|
812
|
+
const { protocol: scheme } = requestCurrentURL(request);
|
|
813
|
+
|
|
814
|
+
// 3. Switch on request’s current URL’s scheme and run the associated steps:
|
|
815
|
+
switch (scheme) {
|
|
816
|
+
case 'about:': {
|
|
817
|
+
// If request’s current URL’s path is the string "blank", then return a new response
|
|
818
|
+
// whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
|
|
819
|
+
// and body is the empty byte sequence as a body.
|
|
820
|
+
|
|
821
|
+
// Otherwise, return a network error.
|
|
822
|
+
return Promise.resolve(makeNetworkError('about scheme is not supported'))
|
|
823
|
+
}
|
|
824
|
+
case 'blob:': {
|
|
825
|
+
if (!resolveObjectURL) {
|
|
826
|
+
resolveObjectURL = require$$7__default.default.resolveObjectURL;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// 1. Let blobURLEntry be request’s current URL’s blob URL entry.
|
|
830
|
+
const blobURLEntry = requestCurrentURL(request);
|
|
831
|
+
|
|
832
|
+
// https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56
|
|
833
|
+
// Buffer.resolveObjectURL does not ignore URL queries.
|
|
834
|
+
if (blobURLEntry.search.length !== 0) {
|
|
835
|
+
return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.'))
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString());
|
|
839
|
+
|
|
840
|
+
// 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s
|
|
841
|
+
// object is not a Blob object, then return a network error.
|
|
842
|
+
if (request.method !== 'GET' || !isBlobLike(blobURLEntryObject)) {
|
|
843
|
+
return Promise.resolve(makeNetworkError('invalid method'))
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// 3. Let bodyWithType be the result of safely extracting blobURLEntry’s object.
|
|
847
|
+
const bodyWithType = safelyExtractBody(blobURLEntryObject);
|
|
848
|
+
|
|
849
|
+
// 4. Let body be bodyWithType’s body.
|
|
850
|
+
const body = bodyWithType[0];
|
|
851
|
+
|
|
852
|
+
// 5. Let length be body’s length, serialized and isomorphic encoded.
|
|
853
|
+
const length = isomorphicEncode(`${body.length}`);
|
|
854
|
+
|
|
855
|
+
// 6. Let type be bodyWithType’s type if it is non-null; otherwise the empty byte sequence.
|
|
856
|
+
const type = bodyWithType[1] ?? '';
|
|
857
|
+
|
|
858
|
+
// 7. Return a new response whose status message is `OK`, header list is
|
|
859
|
+
// « (`Content-Length`, length), (`Content-Type`, type) », and body is body.
|
|
860
|
+
const response = makeResponse({
|
|
861
|
+
statusText: 'OK',
|
|
862
|
+
headersList: [
|
|
863
|
+
['content-length', { name: 'Content-Length', value: length }],
|
|
864
|
+
['content-type', { name: 'Content-Type', value: type }]
|
|
865
|
+
]
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
response.body = body;
|
|
869
|
+
|
|
870
|
+
return Promise.resolve(response)
|
|
871
|
+
}
|
|
872
|
+
case 'data:': {
|
|
873
|
+
// 1. Let dataURLStruct be the result of running the
|
|
874
|
+
// data: URL processor on request’s current URL.
|
|
875
|
+
const currentURL = requestCurrentURL(request);
|
|
876
|
+
const dataURLStruct = dataURLProcessor(currentURL);
|
|
877
|
+
|
|
878
|
+
// 2. If dataURLStruct is failure, then return a
|
|
879
|
+
// network error.
|
|
880
|
+
if (dataURLStruct === 'failure') {
|
|
881
|
+
return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// 3. Let mimeType be dataURLStruct’s MIME type, serialized.
|
|
885
|
+
const mimeType = serializeAMimeType(dataURLStruct.mimeType);
|
|
886
|
+
|
|
887
|
+
// 4. Return a response whose status message is `OK`,
|
|
888
|
+
// header list is « (`Content-Type`, mimeType) »,
|
|
889
|
+
// and body is dataURLStruct’s body as a body.
|
|
890
|
+
return Promise.resolve(makeResponse({
|
|
891
|
+
statusText: 'OK',
|
|
892
|
+
headersList: [
|
|
893
|
+
['content-type', { name: 'Content-Type', value: mimeType }]
|
|
894
|
+
],
|
|
895
|
+
body: safelyExtractBody(dataURLStruct.body)[0]
|
|
896
|
+
}))
|
|
897
|
+
}
|
|
898
|
+
case 'file:': {
|
|
899
|
+
// For now, unfortunate as it is, file URLs are left as an exercise for the reader.
|
|
900
|
+
// When in doubt, return a network error.
|
|
901
|
+
return Promise.resolve(makeNetworkError('not implemented... yet...'))
|
|
902
|
+
}
|
|
903
|
+
case 'http:':
|
|
904
|
+
case 'https:': {
|
|
905
|
+
// Return the result of running HTTP fetch given fetchParams.
|
|
906
|
+
|
|
907
|
+
return httpFetch(fetchParams)
|
|
908
|
+
.catch((err) => makeNetworkError(err))
|
|
909
|
+
}
|
|
910
|
+
default: {
|
|
911
|
+
return Promise.resolve(makeNetworkError('unknown scheme'))
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// https://fetch.spec.whatwg.org/#finalize-response
|
|
917
|
+
function finalizeResponse (fetchParams, response) {
|
|
918
|
+
// 1. Set fetchParams’s request’s done flag.
|
|
919
|
+
fetchParams.request.done = true;
|
|
920
|
+
|
|
921
|
+
// 2, If fetchParams’s process response done is not null, then queue a fetch
|
|
922
|
+
// task to run fetchParams’s process response done given response, with
|
|
923
|
+
// fetchParams’s task destination.
|
|
924
|
+
if (fetchParams.processResponseDone != null) {
|
|
925
|
+
queueMicrotask(() => fetchParams.processResponseDone(response));
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// https://fetch.spec.whatwg.org/#fetch-finale
|
|
930
|
+
function fetchFinale (fetchParams, response) {
|
|
931
|
+
// 1. If response is a network error, then:
|
|
932
|
+
if (response.type === 'error') {
|
|
933
|
+
// 1. Set response’s URL list to « fetchParams’s request’s URL list[0] ».
|
|
934
|
+
response.urlList = [fetchParams.request.urlList[0]];
|
|
935
|
+
|
|
936
|
+
// 2. Set response’s timing info to the result of creating an opaque timing
|
|
937
|
+
// info for fetchParams’s timing info.
|
|
938
|
+
response.timingInfo = createOpaqueTimingInfo({
|
|
939
|
+
startTime: fetchParams.timingInfo.startTime
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// 2. Let processResponseEndOfBody be the following steps:
|
|
944
|
+
const processResponseEndOfBody = () => {
|
|
945
|
+
// 1. Set fetchParams’s request’s done flag.
|
|
946
|
+
fetchParams.request.done = true;
|
|
947
|
+
|
|
948
|
+
// If fetchParams’s process response end-of-body is not null,
|
|
949
|
+
// then queue a fetch task to run fetchParams’s process response
|
|
950
|
+
// end-of-body given response with fetchParams’s task destination.
|
|
951
|
+
if (fetchParams.processResponseEndOfBody != null) {
|
|
952
|
+
queueMicrotask(() => fetchParams.processResponseEndOfBody(response));
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
// 3. If fetchParams’s process response is non-null, then queue a fetch task
|
|
957
|
+
// to run fetchParams’s process response given response, with fetchParams’s
|
|
958
|
+
// task destination.
|
|
959
|
+
if (fetchParams.processResponse != null) {
|
|
960
|
+
queueMicrotask(() => fetchParams.processResponse(response));
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// 4. If response’s body is null, then run processResponseEndOfBody.
|
|
964
|
+
if (response.body == null) {
|
|
965
|
+
processResponseEndOfBody();
|
|
966
|
+
} else {
|
|
967
|
+
// 5. Otherwise:
|
|
968
|
+
|
|
969
|
+
// 1. Let transformStream be a new a TransformStream.
|
|
970
|
+
|
|
971
|
+
// 2. Let identityTransformAlgorithm be an algorithm which, given chunk,
|
|
972
|
+
// enqueues chunk in transformStream.
|
|
973
|
+
const identityTransformAlgorithm = (chunk, controller) => {
|
|
974
|
+
controller.enqueue(chunk);
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
// 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm
|
|
978
|
+
// and flushAlgorithm set to processResponseEndOfBody.
|
|
979
|
+
const transformStream = new TransformStream({
|
|
980
|
+
start () {},
|
|
981
|
+
transform: identityTransformAlgorithm,
|
|
982
|
+
flush: processResponseEndOfBody
|
|
983
|
+
}, {
|
|
984
|
+
size () {
|
|
985
|
+
return 1
|
|
986
|
+
}
|
|
987
|
+
}, {
|
|
988
|
+
size () {
|
|
989
|
+
return 1
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
|
|
993
|
+
// 4. Set response’s body to the result of piping response’s body through transformStream.
|
|
994
|
+
response.body = { stream: response.body.stream.pipeThrough(transformStream) };
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// 6. If fetchParams’s process response consume body is non-null, then:
|
|
998
|
+
if (fetchParams.processResponseConsumeBody != null) {
|
|
999
|
+
// 1. Let processBody given nullOrBytes be this step: run fetchParams’s
|
|
1000
|
+
// process response consume body given response and nullOrBytes.
|
|
1001
|
+
const processBody = (nullOrBytes) => fetchParams.processResponseConsumeBody(response, nullOrBytes);
|
|
1002
|
+
|
|
1003
|
+
// 2. Let processBodyError be this step: run fetchParams’s process
|
|
1004
|
+
// response consume body given response and failure.
|
|
1005
|
+
const processBodyError = (failure) => fetchParams.processResponseConsumeBody(response, failure);
|
|
1006
|
+
|
|
1007
|
+
// 3. If response’s body is null, then queue a fetch task to run processBody
|
|
1008
|
+
// given null, with fetchParams’s task destination.
|
|
1009
|
+
if (response.body == null) {
|
|
1010
|
+
queueMicrotask(() => processBody(null));
|
|
1011
|
+
} else {
|
|
1012
|
+
// 4. Otherwise, fully read response’s body given processBody, processBodyError,
|
|
1013
|
+
// and fetchParams’s task destination.
|
|
1014
|
+
return fullyReadBody(response.body, processBody, processBodyError)
|
|
1015
|
+
}
|
|
1016
|
+
return Promise.resolve()
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// https://fetch.spec.whatwg.org/#http-fetch
|
|
1021
|
+
async function httpFetch (fetchParams) {
|
|
1022
|
+
// 1. Let request be fetchParams’s request.
|
|
1023
|
+
const request = fetchParams.request;
|
|
1024
|
+
|
|
1025
|
+
// 2. Let response be null.
|
|
1026
|
+
let response = null;
|
|
1027
|
+
|
|
1028
|
+
// 3. Let actualResponse be null.
|
|
1029
|
+
let actualResponse = null;
|
|
1030
|
+
|
|
1031
|
+
// 4. Let timingInfo be fetchParams’s timing info.
|
|
1032
|
+
const timingInfo = fetchParams.timingInfo;
|
|
1033
|
+
|
|
1034
|
+
// 5. If request’s service-workers mode is "all", then:
|
|
1035
|
+
if (request.serviceWorkers === 'all') ;
|
|
1036
|
+
|
|
1037
|
+
// 6. If response is null, then:
|
|
1038
|
+
if (response === null) {
|
|
1039
|
+
// 1. If makeCORSPreflight is true and one of these conditions is true:
|
|
1040
|
+
// TODO
|
|
1041
|
+
|
|
1042
|
+
// 2. If request’s redirect mode is "follow", then set request’s
|
|
1043
|
+
// service-workers mode to "none".
|
|
1044
|
+
if (request.redirect === 'follow') {
|
|
1045
|
+
request.serviceWorkers = 'none';
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// 3. Set response and actualResponse to the result of running
|
|
1049
|
+
// HTTP-network-or-cache fetch given fetchParams.
|
|
1050
|
+
actualResponse = response = await httpNetworkOrCacheFetch(fetchParams);
|
|
1051
|
+
|
|
1052
|
+
// 4. If request’s response tainting is "cors" and a CORS check
|
|
1053
|
+
// for request and response returns failure, then return a network error.
|
|
1054
|
+
if (
|
|
1055
|
+
request.responseTainting === 'cors' &&
|
|
1056
|
+
corsCheck(request, response) === 'failure'
|
|
1057
|
+
) {
|
|
1058
|
+
return makeNetworkError('cors failure')
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// 5. If the TAO check for request and response returns failure, then set
|
|
1062
|
+
// request’s timing allow failed flag.
|
|
1063
|
+
if (TAOCheck(request, response) === 'failure') {
|
|
1064
|
+
request.timingAllowFailed = true;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// 7. If either request’s response tainting or response’s type
|
|
1069
|
+
// is "opaque", and the cross-origin resource policy check with
|
|
1070
|
+
// request’s origin, request’s client, request’s destination,
|
|
1071
|
+
// and actualResponse returns blocked, then return a network error.
|
|
1072
|
+
if (
|
|
1073
|
+
(request.responseTainting === 'opaque' || response.type === 'opaque') &&
|
|
1074
|
+
crossOriginResourcePolicyCheck(
|
|
1075
|
+
request.origin,
|
|
1076
|
+
request.client,
|
|
1077
|
+
request.destination,
|
|
1078
|
+
actualResponse
|
|
1079
|
+
) === 'blocked'
|
|
1080
|
+
) {
|
|
1081
|
+
return makeNetworkError('blocked')
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
// 8. If actualResponse’s status is a redirect status, then:
|
|
1085
|
+
if (redirectStatusSet.has(actualResponse.status)) {
|
|
1086
|
+
// 1. If actualResponse’s status is not 303, request’s body is not null,
|
|
1087
|
+
// and the connection uses HTTP/2, then user agents may, and are even
|
|
1088
|
+
// encouraged to, transmit an RST_STREAM frame.
|
|
1089
|
+
// See, https://github.com/whatwg/fetch/issues/1288
|
|
1090
|
+
if (request.redirect !== 'manual') {
|
|
1091
|
+
fetchParams.controller.connection.destroy();
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// 2. Switch on request’s redirect mode:
|
|
1095
|
+
if (request.redirect === 'error') {
|
|
1096
|
+
// Set response to a network error.
|
|
1097
|
+
response = makeNetworkError('unexpected redirect');
|
|
1098
|
+
} else if (request.redirect === 'manual') {
|
|
1099
|
+
// Set response to an opaque-redirect filtered response whose internal
|
|
1100
|
+
// response is actualResponse.
|
|
1101
|
+
// NOTE(spec): On the web this would return an `opaqueredirect` response,
|
|
1102
|
+
// but that doesn't make sense server side.
|
|
1103
|
+
// See https://github.com/nodejs/undici/issues/1193.
|
|
1104
|
+
response = actualResponse;
|
|
1105
|
+
} else if (request.redirect === 'follow') {
|
|
1106
|
+
// Set response to the result of running HTTP-redirect fetch given
|
|
1107
|
+
// fetchParams and response.
|
|
1108
|
+
response = await httpRedirectFetch(fetchParams, response);
|
|
1109
|
+
} else {
|
|
1110
|
+
assert(false);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
// 9. Set response’s timing info to timingInfo.
|
|
1115
|
+
response.timingInfo = timingInfo;
|
|
1116
|
+
|
|
1117
|
+
// 10. Return response.
|
|
1118
|
+
return response
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// https://fetch.spec.whatwg.org/#http-redirect-fetch
|
|
1122
|
+
function httpRedirectFetch (fetchParams, response) {
|
|
1123
|
+
// 1. Let request be fetchParams’s request.
|
|
1124
|
+
const request = fetchParams.request;
|
|
1125
|
+
|
|
1126
|
+
// 2. Let actualResponse be response, if response is not a filtered response,
|
|
1127
|
+
// and response’s internal response otherwise.
|
|
1128
|
+
const actualResponse = response.internalResponse
|
|
1129
|
+
? response.internalResponse
|
|
1130
|
+
: response;
|
|
1131
|
+
|
|
1132
|
+
// 3. Let locationURL be actualResponse’s location URL given request’s current
|
|
1133
|
+
// URL’s fragment.
|
|
1134
|
+
let locationURL;
|
|
1135
|
+
|
|
1136
|
+
try {
|
|
1137
|
+
locationURL = responseLocationURL(
|
|
1138
|
+
actualResponse,
|
|
1139
|
+
requestCurrentURL(request).hash
|
|
1140
|
+
);
|
|
1141
|
+
|
|
1142
|
+
// 4. If locationURL is null, then return response.
|
|
1143
|
+
if (locationURL == null) {
|
|
1144
|
+
return response
|
|
1145
|
+
}
|
|
1146
|
+
} catch (err) {
|
|
1147
|
+
// 5. If locationURL is failure, then return a network error.
|
|
1148
|
+
return Promise.resolve(makeNetworkError(err))
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network
|
|
1152
|
+
// error.
|
|
1153
|
+
if (!urlIsHttpHttpsScheme(locationURL)) {
|
|
1154
|
+
return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme'))
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
// 7. If request’s redirect count is 20, then return a network error.
|
|
1158
|
+
if (request.redirectCount === 20) {
|
|
1159
|
+
return Promise.resolve(makeNetworkError('redirect count exceeded'))
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// 8. Increase request’s redirect count by 1.
|
|
1163
|
+
request.redirectCount += 1;
|
|
1164
|
+
|
|
1165
|
+
// 9. If request’s mode is "cors", locationURL includes credentials, and
|
|
1166
|
+
// request’s origin is not same origin with locationURL’s origin, then return
|
|
1167
|
+
// a network error.
|
|
1168
|
+
if (
|
|
1169
|
+
request.mode === 'cors' &&
|
|
1170
|
+
(locationURL.username || locationURL.password) &&
|
|
1171
|
+
!sameOrigin(request, locationURL)
|
|
1172
|
+
) {
|
|
1173
|
+
return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"'))
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// 10. If request’s response tainting is "cors" and locationURL includes
|
|
1177
|
+
// credentials, then return a network error.
|
|
1178
|
+
if (
|
|
1179
|
+
request.responseTainting === 'cors' &&
|
|
1180
|
+
(locationURL.username || locationURL.password)
|
|
1181
|
+
) {
|
|
1182
|
+
return Promise.resolve(makeNetworkError(
|
|
1183
|
+
'URL cannot contain credentials for request mode "cors"'
|
|
1184
|
+
))
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// 11. If actualResponse’s status is not 303, request’s body is non-null,
|
|
1188
|
+
// and request’s body’s source is null, then return a network error.
|
|
1189
|
+
if (
|
|
1190
|
+
actualResponse.status !== 303 &&
|
|
1191
|
+
request.body != null &&
|
|
1192
|
+
request.body.source == null
|
|
1193
|
+
) {
|
|
1194
|
+
return Promise.resolve(makeNetworkError())
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// 12. If one of the following is true
|
|
1198
|
+
// - actualResponse’s status is 301 or 302 and request’s method is `POST`
|
|
1199
|
+
// - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD`
|
|
1200
|
+
if (
|
|
1201
|
+
([301, 302].includes(actualResponse.status) && request.method === 'POST') ||
|
|
1202
|
+
(actualResponse.status === 303 &&
|
|
1203
|
+
!GET_OR_HEAD.includes(request.method))
|
|
1204
|
+
) {
|
|
1205
|
+
// then:
|
|
1206
|
+
// 1. Set request’s method to `GET` and request’s body to null.
|
|
1207
|
+
request.method = 'GET';
|
|
1208
|
+
request.body = null;
|
|
1209
|
+
|
|
1210
|
+
// 2. For each headerName of request-body-header name, delete headerName from
|
|
1211
|
+
// request’s header list.
|
|
1212
|
+
for (const headerName of requestBodyHeader) {
|
|
1213
|
+
request.headersList.delete(headerName);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// 13. If request’s current URL’s origin is not same origin with locationURL’s
|
|
1218
|
+
// origin, then for each headerName of CORS non-wildcard request-header name,
|
|
1219
|
+
// delete headerName from request’s header list.
|
|
1220
|
+
if (!sameOrigin(requestCurrentURL(request), locationURL)) {
|
|
1221
|
+
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
|
|
1222
|
+
request.headersList.delete('authorization');
|
|
1223
|
+
|
|
1224
|
+
// https://fetch.spec.whatwg.org/#authentication-entries
|
|
1225
|
+
request.headersList.delete('proxy-authorization', true);
|
|
1226
|
+
|
|
1227
|
+
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
|
|
1228
|
+
request.headersList.delete('cookie');
|
|
1229
|
+
request.headersList.delete('host');
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// 14. If request’s body is non-null, then set request’s body to the first return
|
|
1233
|
+
// value of safely extracting request’s body’s source.
|
|
1234
|
+
if (request.body != null) {
|
|
1235
|
+
assert(request.body.source != null);
|
|
1236
|
+
request.body = safelyExtractBody(request.body.source)[0];
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// 15. Let timingInfo be fetchParams’s timing info.
|
|
1240
|
+
const timingInfo = fetchParams.timingInfo;
|
|
1241
|
+
|
|
1242
|
+
// 16. Set timingInfo’s redirect end time and post-redirect start time to the
|
|
1243
|
+
// coarsened shared current time given fetchParams’s cross-origin isolated
|
|
1244
|
+
// capability.
|
|
1245
|
+
timingInfo.redirectEndTime = timingInfo.postRedirectStartTime =
|
|
1246
|
+
coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability);
|
|
1247
|
+
|
|
1248
|
+
// 17. If timingInfo’s redirect start time is 0, then set timingInfo’s
|
|
1249
|
+
// redirect start time to timingInfo’s start time.
|
|
1250
|
+
if (timingInfo.redirectStartTime === 0) {
|
|
1251
|
+
timingInfo.redirectStartTime = timingInfo.startTime;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// 18. Append locationURL to request’s URL list.
|
|
1255
|
+
request.urlList.push(locationURL);
|
|
1256
|
+
|
|
1257
|
+
// 19. Invoke set request’s referrer policy on redirect on request and
|
|
1258
|
+
// actualResponse.
|
|
1259
|
+
setRequestReferrerPolicyOnRedirect(request, actualResponse);
|
|
1260
|
+
|
|
1261
|
+
// 20. Return the result of running main fetch given fetchParams and true.
|
|
1262
|
+
return mainFetch(fetchParams, true)
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
|
|
1266
|
+
async function httpNetworkOrCacheFetch (
|
|
1267
|
+
fetchParams,
|
|
1268
|
+
isAuthenticationFetch = false,
|
|
1269
|
+
isNewConnectionFetch = false
|
|
1270
|
+
) {
|
|
1271
|
+
// 1. Let request be fetchParams’s request.
|
|
1272
|
+
const request = fetchParams.request;
|
|
1273
|
+
|
|
1274
|
+
// 2. Let httpFetchParams be null.
|
|
1275
|
+
let httpFetchParams = null;
|
|
1276
|
+
|
|
1277
|
+
// 3. Let httpRequest be null.
|
|
1278
|
+
let httpRequest = null;
|
|
1279
|
+
|
|
1280
|
+
// 4. Let response be null.
|
|
1281
|
+
let response = null;
|
|
1282
|
+
|
|
1283
|
+
// 8. Run these steps, but abort when the ongoing fetch is terminated:
|
|
1284
|
+
|
|
1285
|
+
// 1. If request’s window is "no-window" and request’s redirect mode is
|
|
1286
|
+
// "error", then set httpFetchParams to fetchParams and httpRequest to
|
|
1287
|
+
// request.
|
|
1288
|
+
if (request.window === 'no-window' && request.redirect === 'error') {
|
|
1289
|
+
httpFetchParams = fetchParams;
|
|
1290
|
+
httpRequest = request;
|
|
1291
|
+
} else {
|
|
1292
|
+
// Otherwise:
|
|
1293
|
+
|
|
1294
|
+
// 1. Set httpRequest to a clone of request.
|
|
1295
|
+
httpRequest = makeRequest(request);
|
|
1296
|
+
|
|
1297
|
+
// 2. Set httpFetchParams to a copy of fetchParams.
|
|
1298
|
+
httpFetchParams = { ...fetchParams };
|
|
1299
|
+
|
|
1300
|
+
// 3. Set httpFetchParams’s request to httpRequest.
|
|
1301
|
+
httpFetchParams.request = httpRequest;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
// 3. Let includeCredentials be true if one of
|
|
1305
|
+
const includeCredentials =
|
|
1306
|
+
request.credentials === 'include' ||
|
|
1307
|
+
(request.credentials === 'same-origin' &&
|
|
1308
|
+
request.responseTainting === 'basic');
|
|
1309
|
+
|
|
1310
|
+
// 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s
|
|
1311
|
+
// body is non-null; otherwise null.
|
|
1312
|
+
const contentLength = httpRequest.body ? httpRequest.body.length : null;
|
|
1313
|
+
|
|
1314
|
+
// 5. Let contentLengthHeaderValue be null.
|
|
1315
|
+
let contentLengthHeaderValue = null;
|
|
1316
|
+
|
|
1317
|
+
// 6. If httpRequest’s body is null and httpRequest’s method is `POST` or
|
|
1318
|
+
// `PUT`, then set contentLengthHeaderValue to `0`.
|
|
1319
|
+
if (
|
|
1320
|
+
httpRequest.body == null &&
|
|
1321
|
+
['POST', 'PUT'].includes(httpRequest.method)
|
|
1322
|
+
) {
|
|
1323
|
+
contentLengthHeaderValue = '0';
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
// 7. If contentLength is non-null, then set contentLengthHeaderValue to
|
|
1327
|
+
// contentLength, serialized and isomorphic encoded.
|
|
1328
|
+
if (contentLength != null) {
|
|
1329
|
+
contentLengthHeaderValue = isomorphicEncode(`${contentLength}`);
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
// 8. If contentLengthHeaderValue is non-null, then append
|
|
1333
|
+
// `Content-Length`/contentLengthHeaderValue to httpRequest’s header
|
|
1334
|
+
// list.
|
|
1335
|
+
if (contentLengthHeaderValue != null) {
|
|
1336
|
+
httpRequest.headersList.append('content-length', contentLengthHeaderValue);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`,
|
|
1340
|
+
// contentLengthHeaderValue) to httpRequest’s header list.
|
|
1341
|
+
|
|
1342
|
+
// 10. If contentLength is non-null and httpRequest’s keepalive is true,
|
|
1343
|
+
// then:
|
|
1344
|
+
if (contentLength != null && httpRequest.keepalive) ;
|
|
1345
|
+
|
|
1346
|
+
// 11. If httpRequest’s referrer is a URL, then append
|
|
1347
|
+
// `Referer`/httpRequest’s referrer, serialized and isomorphic encoded,
|
|
1348
|
+
// to httpRequest’s header list.
|
|
1349
|
+
if (httpRequest.referrer instanceof URL) {
|
|
1350
|
+
httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href));
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// 12. Append a request `Origin` header for httpRequest.
|
|
1354
|
+
appendRequestOriginHeader(httpRequest);
|
|
1355
|
+
|
|
1356
|
+
// 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA]
|
|
1357
|
+
appendFetchMetadata(httpRequest);
|
|
1358
|
+
|
|
1359
|
+
// 14. If httpRequest’s header list does not contain `User-Agent`, then
|
|
1360
|
+
// user agents should append `User-Agent`/default `User-Agent` value to
|
|
1361
|
+
// httpRequest’s header list.
|
|
1362
|
+
if (!httpRequest.headersList.contains('user-agent')) {
|
|
1363
|
+
httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node');
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// 15. If httpRequest’s cache mode is "default" and httpRequest’s header
|
|
1367
|
+
// list contains `If-Modified-Since`, `If-None-Match`,
|
|
1368
|
+
// `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set
|
|
1369
|
+
// httpRequest’s cache mode to "no-store".
|
|
1370
|
+
if (
|
|
1371
|
+
httpRequest.cache === 'default' &&
|
|
1372
|
+
(httpRequest.headersList.contains('if-modified-since') ||
|
|
1373
|
+
httpRequest.headersList.contains('if-none-match') ||
|
|
1374
|
+
httpRequest.headersList.contains('if-unmodified-since') ||
|
|
1375
|
+
httpRequest.headersList.contains('if-match') ||
|
|
1376
|
+
httpRequest.headersList.contains('if-range'))
|
|
1377
|
+
) {
|
|
1378
|
+
httpRequest.cache = 'no-store';
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
// 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent
|
|
1382
|
+
// no-cache cache-control header modification flag is unset, and
|
|
1383
|
+
// httpRequest’s header list does not contain `Cache-Control`, then append
|
|
1384
|
+
// `Cache-Control`/`max-age=0` to httpRequest’s header list.
|
|
1385
|
+
if (
|
|
1386
|
+
httpRequest.cache === 'no-cache' &&
|
|
1387
|
+
!httpRequest.preventNoCacheCacheControlHeaderModification &&
|
|
1388
|
+
!httpRequest.headersList.contains('cache-control')
|
|
1389
|
+
) {
|
|
1390
|
+
httpRequest.headersList.append('cache-control', 'max-age=0');
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// 17. If httpRequest’s cache mode is "no-store" or "reload", then:
|
|
1394
|
+
if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') {
|
|
1395
|
+
// 1. If httpRequest’s header list does not contain `Pragma`, then append
|
|
1396
|
+
// `Pragma`/`no-cache` to httpRequest’s header list.
|
|
1397
|
+
if (!httpRequest.headersList.contains('pragma')) {
|
|
1398
|
+
httpRequest.headersList.append('pragma', 'no-cache');
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
// 2. If httpRequest’s header list does not contain `Cache-Control`,
|
|
1402
|
+
// then append `Cache-Control`/`no-cache` to httpRequest’s header list.
|
|
1403
|
+
if (!httpRequest.headersList.contains('cache-control')) {
|
|
1404
|
+
httpRequest.headersList.append('cache-control', 'no-cache');
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
// 18. If httpRequest’s header list contains `Range`, then append
|
|
1409
|
+
// `Accept-Encoding`/`identity` to httpRequest’s header list.
|
|
1410
|
+
if (httpRequest.headersList.contains('range')) {
|
|
1411
|
+
httpRequest.headersList.append('accept-encoding', 'identity');
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
// 19. Modify httpRequest’s header list per HTTP. Do not append a given
|
|
1415
|
+
// header if httpRequest’s header list contains that header’s name.
|
|
1416
|
+
// TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129
|
|
1417
|
+
if (!httpRequest.headersList.contains('accept-encoding')) {
|
|
1418
|
+
if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) {
|
|
1419
|
+
httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate');
|
|
1420
|
+
} else {
|
|
1421
|
+
httpRequest.headersList.append('accept-encoding', 'gzip, deflate');
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
httpRequest.headersList.delete('host');
|
|
1426
|
+
|
|
1427
|
+
// 21. If there’s a proxy-authentication entry, use it as appropriate.
|
|
1428
|
+
// TODO: proxy-authentication
|
|
1429
|
+
|
|
1430
|
+
// 22. Set httpCache to the result of determining the HTTP cache
|
|
1431
|
+
// partition, given httpRequest.
|
|
1432
|
+
// TODO: cache
|
|
1433
|
+
|
|
1434
|
+
// 23. If httpCache is null, then set httpRequest’s cache mode to
|
|
1435
|
+
// "no-store".
|
|
1436
|
+
{
|
|
1437
|
+
httpRequest.cache = 'no-store';
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
// 24. If httpRequest’s cache mode is neither "no-store" nor "reload",
|
|
1441
|
+
// then:
|
|
1442
|
+
if (httpRequest.mode !== 'no-store' && httpRequest.mode !== 'reload') ;
|
|
1443
|
+
|
|
1444
|
+
// 9. If aborted, then return the appropriate network error for fetchParams.
|
|
1445
|
+
// TODO
|
|
1446
|
+
|
|
1447
|
+
// 10. If response is null, then:
|
|
1448
|
+
if (response == null) {
|
|
1449
|
+
// 1. If httpRequest’s cache mode is "only-if-cached", then return a
|
|
1450
|
+
// network error.
|
|
1451
|
+
if (httpRequest.mode === 'only-if-cached') {
|
|
1452
|
+
return makeNetworkError('only if cached')
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// 2. Let forwardResponse be the result of running HTTP-network fetch
|
|
1456
|
+
// given httpFetchParams, includeCredentials, and isNewConnectionFetch.
|
|
1457
|
+
const forwardResponse = await httpNetworkFetch(
|
|
1458
|
+
httpFetchParams,
|
|
1459
|
+
includeCredentials,
|
|
1460
|
+
isNewConnectionFetch
|
|
1461
|
+
);
|
|
1462
|
+
|
|
1463
|
+
// 3. If httpRequest’s method is unsafe and forwardResponse’s status is
|
|
1464
|
+
// in the range 200 to 399, inclusive, invalidate appropriate stored
|
|
1465
|
+
// responses in httpCache, as per the "Invalidation" chapter of HTTP
|
|
1466
|
+
// Caching, and set storedResponse to null. [HTTP-CACHING]
|
|
1467
|
+
if (
|
|
1468
|
+
!safeMethodsSet.has(httpRequest.method) &&
|
|
1469
|
+
forwardResponse.status >= 200 &&
|
|
1470
|
+
forwardResponse.status <= 399
|
|
1471
|
+
) ;
|
|
1472
|
+
|
|
1473
|
+
// 5. If response is null, then:
|
|
1474
|
+
if (response == null) {
|
|
1475
|
+
// 1. Set response to forwardResponse.
|
|
1476
|
+
response = forwardResponse;
|
|
1477
|
+
|
|
1478
|
+
// 2. Store httpRequest and forwardResponse in httpCache, as per the
|
|
1479
|
+
// "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING]
|
|
1480
|
+
// TODO: cache
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
// 11. Set response’s URL list to a clone of httpRequest’s URL list.
|
|
1485
|
+
response.urlList = [...httpRequest.urlList];
|
|
1486
|
+
|
|
1487
|
+
// 12. If httpRequest’s header list contains `Range`, then set response’s
|
|
1488
|
+
// range-requested flag.
|
|
1489
|
+
if (httpRequest.headersList.contains('range')) {
|
|
1490
|
+
response.rangeRequested = true;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// 13. Set response’s request-includes-credentials to includeCredentials.
|
|
1494
|
+
response.requestIncludesCredentials = includeCredentials;
|
|
1495
|
+
|
|
1496
|
+
// 14. If response’s status is 401, httpRequest’s response tainting is not
|
|
1497
|
+
// "cors", includeCredentials is true, and request’s window is an environment
|
|
1498
|
+
// settings object, then:
|
|
1499
|
+
// TODO
|
|
1500
|
+
|
|
1501
|
+
// 15. If response’s status is 407, then:
|
|
1502
|
+
if (response.status === 407) {
|
|
1503
|
+
// 1. If request’s window is "no-window", then return a network error.
|
|
1504
|
+
if (request.window === 'no-window') {
|
|
1505
|
+
return makeNetworkError()
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// 2. ???
|
|
1509
|
+
|
|
1510
|
+
// 3. If fetchParams is canceled, then return the appropriate network error for fetchParams.
|
|
1511
|
+
if (isCancelled(fetchParams)) {
|
|
1512
|
+
return makeAppropriateNetworkError(fetchParams)
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
// 4. Prompt the end user as appropriate in request’s window and store
|
|
1516
|
+
// the result as a proxy-authentication entry. [HTTP-AUTH]
|
|
1517
|
+
// TODO: Invoke some kind of callback?
|
|
1518
|
+
|
|
1519
|
+
// 5. Set response to the result of running HTTP-network-or-cache fetch given
|
|
1520
|
+
// fetchParams.
|
|
1521
|
+
// TODO
|
|
1522
|
+
return makeNetworkError('proxy authentication required')
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// 16. If all of the following are true
|
|
1526
|
+
if (
|
|
1527
|
+
// response’s status is 421
|
|
1528
|
+
response.status === 421 &&
|
|
1529
|
+
// isNewConnectionFetch is false
|
|
1530
|
+
!isNewConnectionFetch &&
|
|
1531
|
+
// request’s body is null, or request’s body is non-null and request’s body’s source is non-null
|
|
1532
|
+
(request.body == null || request.body.source != null)
|
|
1533
|
+
) {
|
|
1534
|
+
// then:
|
|
1535
|
+
|
|
1536
|
+
// 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
|
|
1537
|
+
if (isCancelled(fetchParams)) {
|
|
1538
|
+
return makeAppropriateNetworkError(fetchParams)
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
// 2. Set response to the result of running HTTP-network-or-cache
|
|
1542
|
+
// fetch given fetchParams, isAuthenticationFetch, and true.
|
|
1543
|
+
|
|
1544
|
+
// TODO (spec): The spec doesn't specify this but we need to cancel
|
|
1545
|
+
// the active response before we can start a new one.
|
|
1546
|
+
// https://github.com/whatwg/fetch/issues/1293
|
|
1547
|
+
fetchParams.controller.connection.destroy();
|
|
1548
|
+
|
|
1549
|
+
response = await httpNetworkOrCacheFetch(
|
|
1550
|
+
fetchParams,
|
|
1551
|
+
isAuthenticationFetch,
|
|
1552
|
+
true
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// 18. Return response.
|
|
1557
|
+
return response
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
// https://fetch.spec.whatwg.org/#http-network-fetch
|
|
1561
|
+
async function httpNetworkFetch (
|
|
1562
|
+
fetchParams,
|
|
1563
|
+
includeCredentials = false,
|
|
1564
|
+
forceNewConnection = false
|
|
1565
|
+
) {
|
|
1566
|
+
assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
|
|
1567
|
+
|
|
1568
|
+
fetchParams.controller.connection = {
|
|
1569
|
+
abort: null,
|
|
1570
|
+
destroyed: false,
|
|
1571
|
+
destroy (err) {
|
|
1572
|
+
if (!this.destroyed) {
|
|
1573
|
+
this.destroyed = true;
|
|
1574
|
+
this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'));
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1579
|
+
// 1. Let request be fetchParams’s request.
|
|
1580
|
+
const request = fetchParams.request;
|
|
1581
|
+
|
|
1582
|
+
// 2. Let response be null.
|
|
1583
|
+
let response = null;
|
|
1584
|
+
|
|
1585
|
+
// 3. Let timingInfo be fetchParams’s timing info.
|
|
1586
|
+
const timingInfo = fetchParams.timingInfo;
|
|
1587
|
+
|
|
1588
|
+
// 5. If httpCache is null, then set request’s cache mode to "no-store".
|
|
1589
|
+
{
|
|
1590
|
+
request.cache = 'no-store';
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// 8. Switch on request’s mode:
|
|
1594
|
+
if (request.mode === 'websocket') ;
|
|
1595
|
+
|
|
1596
|
+
// 9. Run these steps, but abort when the ongoing fetch is terminated:
|
|
1597
|
+
|
|
1598
|
+
// 1. If connection is failure, then return a network error.
|
|
1599
|
+
|
|
1600
|
+
// 2. Set timingInfo’s final connection timing info to the result of
|
|
1601
|
+
// calling clamp and coarsen connection timing info with connection’s
|
|
1602
|
+
// timing info, timingInfo’s post-redirect start time, and fetchParams’s
|
|
1603
|
+
// cross-origin isolated capability.
|
|
1604
|
+
|
|
1605
|
+
// 3. If connection is not an HTTP/2 connection, request’s body is non-null,
|
|
1606
|
+
// and request’s body’s source is null, then append (`Transfer-Encoding`,
|
|
1607
|
+
// `chunked`) to request’s header list.
|
|
1608
|
+
|
|
1609
|
+
// 4. Set timingInfo’s final network-request start time to the coarsened
|
|
1610
|
+
// shared current time given fetchParams’s cross-origin isolated
|
|
1611
|
+
// capability.
|
|
1612
|
+
|
|
1613
|
+
// 5. Set response to the result of making an HTTP request over connection
|
|
1614
|
+
// using request with the following caveats:
|
|
1615
|
+
|
|
1616
|
+
// - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS]
|
|
1617
|
+
// [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH]
|
|
1618
|
+
|
|
1619
|
+
// - If request’s body is non-null, and request’s body’s source is null,
|
|
1620
|
+
// then the user agent may have a buffer of up to 64 kibibytes and store
|
|
1621
|
+
// a part of request’s body in that buffer. If the user agent reads from
|
|
1622
|
+
// request’s body beyond that buffer’s size and the user agent needs to
|
|
1623
|
+
// resend request, then instead return a network error.
|
|
1624
|
+
|
|
1625
|
+
// - Set timingInfo’s final network-response start time to the coarsened
|
|
1626
|
+
// shared current time given fetchParams’s cross-origin isolated capability,
|
|
1627
|
+
// immediately after the user agent’s HTTP parser receives the first byte
|
|
1628
|
+
// of the response (e.g., frame header bytes for HTTP/2 or response status
|
|
1629
|
+
// line for HTTP/1.x).
|
|
1630
|
+
|
|
1631
|
+
// - Wait until all the headers are transmitted.
|
|
1632
|
+
|
|
1633
|
+
// - Any responses whose status is in the range 100 to 199, inclusive,
|
|
1634
|
+
// and is not 101, are to be ignored, except for the purposes of setting
|
|
1635
|
+
// timingInfo’s final network-response start time above.
|
|
1636
|
+
|
|
1637
|
+
// - If request’s header list contains `Transfer-Encoding`/`chunked` and
|
|
1638
|
+
// response is transferred via HTTP/1.0 or older, then return a network
|
|
1639
|
+
// error.
|
|
1640
|
+
|
|
1641
|
+
// - If the HTTP request results in a TLS client certificate dialog, then:
|
|
1642
|
+
|
|
1643
|
+
// 1. If request’s window is an environment settings object, make the
|
|
1644
|
+
// dialog available in request’s window.
|
|
1645
|
+
|
|
1646
|
+
// 2. Otherwise, return a network error.
|
|
1647
|
+
|
|
1648
|
+
// To transmit request’s body body, run these steps:
|
|
1649
|
+
let requestBody = null;
|
|
1650
|
+
// 1. If body is null and fetchParams’s process request end-of-body is
|
|
1651
|
+
// non-null, then queue a fetch task given fetchParams’s process request
|
|
1652
|
+
// end-of-body and fetchParams’s task destination.
|
|
1653
|
+
if (request.body == null && fetchParams.processRequestEndOfBody) {
|
|
1654
|
+
queueMicrotask(() => fetchParams.processRequestEndOfBody());
|
|
1655
|
+
} else if (request.body != null) {
|
|
1656
|
+
// 2. Otherwise, if body is non-null:
|
|
1657
|
+
|
|
1658
|
+
// 1. Let processBodyChunk given bytes be these steps:
|
|
1659
|
+
const processBodyChunk = async function * (bytes) {
|
|
1660
|
+
// 1. If the ongoing fetch is terminated, then abort these steps.
|
|
1661
|
+
if (isCancelled(fetchParams)) {
|
|
1662
|
+
return
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
// 2. Run this step in parallel: transmit bytes.
|
|
1666
|
+
yield bytes;
|
|
1667
|
+
|
|
1668
|
+
// 3. If fetchParams’s process request body is non-null, then run
|
|
1669
|
+
// fetchParams’s process request body given bytes’s length.
|
|
1670
|
+
fetchParams.processRequestBodyChunkLength?.(bytes.byteLength);
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1673
|
+
// 2. Let processEndOfBody be these steps:
|
|
1674
|
+
const processEndOfBody = () => {
|
|
1675
|
+
// 1. If fetchParams is canceled, then abort these steps.
|
|
1676
|
+
if (isCancelled(fetchParams)) {
|
|
1677
|
+
return
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
// 2. If fetchParams’s process request end-of-body is non-null,
|
|
1681
|
+
// then run fetchParams’s process request end-of-body.
|
|
1682
|
+
if (fetchParams.processRequestEndOfBody) {
|
|
1683
|
+
fetchParams.processRequestEndOfBody();
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
// 3. Let processBodyError given e be these steps:
|
|
1688
|
+
const processBodyError = (e) => {
|
|
1689
|
+
// 1. If fetchParams is canceled, then abort these steps.
|
|
1690
|
+
if (isCancelled(fetchParams)) {
|
|
1691
|
+
return
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller.
|
|
1695
|
+
if (e.name === 'AbortError') {
|
|
1696
|
+
fetchParams.controller.abort();
|
|
1697
|
+
} else {
|
|
1698
|
+
fetchParams.controller.terminate(e);
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
// 4. Incrementally read request’s body given processBodyChunk, processEndOfBody,
|
|
1703
|
+
// processBodyError, and fetchParams’s task destination.
|
|
1704
|
+
requestBody = (async function * () {
|
|
1705
|
+
try {
|
|
1706
|
+
for await (const bytes of request.body.stream) {
|
|
1707
|
+
yield * processBodyChunk(bytes);
|
|
1708
|
+
}
|
|
1709
|
+
processEndOfBody();
|
|
1710
|
+
} catch (err) {
|
|
1711
|
+
processBodyError(err);
|
|
1712
|
+
}
|
|
1713
|
+
})();
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
try {
|
|
1717
|
+
// socket is only provided for websockets
|
|
1718
|
+
const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody });
|
|
1719
|
+
|
|
1720
|
+
if (socket) {
|
|
1721
|
+
response = makeResponse({ status, statusText, headersList, socket });
|
|
1722
|
+
} else {
|
|
1723
|
+
const iterator = body[Symbol.asyncIterator]();
|
|
1724
|
+
fetchParams.controller.next = () => iterator.next();
|
|
1725
|
+
|
|
1726
|
+
response = makeResponse({ status, statusText, headersList });
|
|
1727
|
+
}
|
|
1728
|
+
} catch (err) {
|
|
1729
|
+
// 10. If aborted, then:
|
|
1730
|
+
if (err.name === 'AbortError') {
|
|
1731
|
+
// 1. If connection uses HTTP/2, then transmit an RST_STREAM frame.
|
|
1732
|
+
fetchParams.controller.connection.destroy();
|
|
1733
|
+
|
|
1734
|
+
// 2. Return the appropriate network error for fetchParams.
|
|
1735
|
+
return makeAppropriateNetworkError(fetchParams, err)
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
return makeNetworkError(err)
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// 11. Let pullAlgorithm be an action that resumes the ongoing fetch
|
|
1742
|
+
// if it is suspended.
|
|
1743
|
+
const pullAlgorithm = () => {
|
|
1744
|
+
fetchParams.controller.resume();
|
|
1745
|
+
};
|
|
1746
|
+
|
|
1747
|
+
// 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s
|
|
1748
|
+
// controller with reason, given reason.
|
|
1749
|
+
const cancelAlgorithm = (reason) => {
|
|
1750
|
+
fetchParams.controller.abort(reason);
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
// 13. Let highWaterMark be a non-negative, non-NaN number, chosen by
|
|
1754
|
+
// the user agent.
|
|
1755
|
+
// TODO
|
|
1756
|
+
|
|
1757
|
+
// 14. Let sizeAlgorithm be an algorithm that accepts a chunk object
|
|
1758
|
+
// and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent.
|
|
1759
|
+
// TODO
|
|
1760
|
+
|
|
1761
|
+
// 15. Let stream be a new ReadableStream.
|
|
1762
|
+
// 16. Set up stream with pullAlgorithm set to pullAlgorithm,
|
|
1763
|
+
// cancelAlgorithm set to cancelAlgorithm, highWaterMark set to
|
|
1764
|
+
// highWaterMark, and sizeAlgorithm set to sizeAlgorithm.
|
|
1765
|
+
if (!ReadableStream) {
|
|
1766
|
+
ReadableStream = require$$14__default.default.ReadableStream;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
const stream = new ReadableStream(
|
|
1770
|
+
{
|
|
1771
|
+
async start (controller) {
|
|
1772
|
+
fetchParams.controller.controller = controller;
|
|
1773
|
+
},
|
|
1774
|
+
async pull (controller) {
|
|
1775
|
+
await pullAlgorithm();
|
|
1776
|
+
},
|
|
1777
|
+
async cancel (reason) {
|
|
1778
|
+
await cancelAlgorithm(reason);
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
{
|
|
1782
|
+
highWaterMark: 0,
|
|
1783
|
+
size () {
|
|
1784
|
+
return 1
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
);
|
|
1788
|
+
|
|
1789
|
+
// 17. Run these steps, but abort when the ongoing fetch is terminated:
|
|
1790
|
+
|
|
1791
|
+
// 1. Set response’s body to a new body whose stream is stream.
|
|
1792
|
+
response.body = { stream };
|
|
1793
|
+
|
|
1794
|
+
// 2. If response is not a network error and request’s cache mode is
|
|
1795
|
+
// not "no-store", then update response in httpCache for request.
|
|
1796
|
+
// TODO
|
|
1797
|
+
|
|
1798
|
+
// 3. If includeCredentials is true and the user agent is not configured
|
|
1799
|
+
// to block cookies for request (see section 7 of [COOKIES]), then run the
|
|
1800
|
+
// "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on
|
|
1801
|
+
// the value of each header whose name is a byte-case-insensitive match for
|
|
1802
|
+
// `Set-Cookie` in response’s header list, if any, and request’s current URL.
|
|
1803
|
+
// TODO
|
|
1804
|
+
|
|
1805
|
+
// 18. If aborted, then:
|
|
1806
|
+
// TODO
|
|
1807
|
+
|
|
1808
|
+
// 19. Run these steps in parallel:
|
|
1809
|
+
|
|
1810
|
+
// 1. Run these steps, but abort when fetchParams is canceled:
|
|
1811
|
+
fetchParams.controller.on('terminated', onAborted);
|
|
1812
|
+
fetchParams.controller.resume = async () => {
|
|
1813
|
+
// 1. While true
|
|
1814
|
+
while (true) {
|
|
1815
|
+
// 1-3. See onData...
|
|
1816
|
+
|
|
1817
|
+
// 4. Set bytes to the result of handling content codings given
|
|
1818
|
+
// codings and bytes.
|
|
1819
|
+
let bytes;
|
|
1820
|
+
let isFailure;
|
|
1821
|
+
try {
|
|
1822
|
+
const { done, value } = await fetchParams.controller.next();
|
|
1823
|
+
|
|
1824
|
+
if (isAborted(fetchParams)) {
|
|
1825
|
+
break
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
bytes = done ? undefined : value;
|
|
1829
|
+
} catch (err) {
|
|
1830
|
+
if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
|
|
1831
|
+
// zlib doesn't like empty streams.
|
|
1832
|
+
bytes = undefined;
|
|
1833
|
+
} else {
|
|
1834
|
+
bytes = err;
|
|
1835
|
+
|
|
1836
|
+
// err may be propagated from the result of calling readablestream.cancel,
|
|
1837
|
+
// which might not be an error. https://github.com/nodejs/undici/issues/2009
|
|
1838
|
+
isFailure = true;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
if (bytes === undefined) {
|
|
1843
|
+
// 2. Otherwise, if the bytes transmission for response’s message
|
|
1844
|
+
// body is done normally and stream is readable, then close
|
|
1845
|
+
// stream, finalize response for fetchParams and response, and
|
|
1846
|
+
// abort these in-parallel steps.
|
|
1847
|
+
readableStreamClose(fetchParams.controller.controller);
|
|
1848
|
+
|
|
1849
|
+
finalizeResponse(fetchParams, response);
|
|
1850
|
+
|
|
1851
|
+
return
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
// 5. Increase timingInfo’s decoded body size by bytes’s length.
|
|
1855
|
+
timingInfo.decodedBodySize += bytes?.byteLength ?? 0;
|
|
1856
|
+
|
|
1857
|
+
// 6. If bytes is failure, then terminate fetchParams’s controller.
|
|
1858
|
+
if (isFailure) {
|
|
1859
|
+
fetchParams.controller.terminate(bytes);
|
|
1860
|
+
return
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
// 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes
|
|
1864
|
+
// into stream.
|
|
1865
|
+
fetchParams.controller.controller.enqueue(new Uint8Array(bytes));
|
|
1866
|
+
|
|
1867
|
+
// 8. If stream is errored, then terminate the ongoing fetch.
|
|
1868
|
+
if (isErrored(stream)) {
|
|
1869
|
+
fetchParams.controller.terminate();
|
|
1870
|
+
return
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
// 9. If stream doesn’t need more data ask the user agent to suspend
|
|
1874
|
+
// the ongoing fetch.
|
|
1875
|
+
if (!fetchParams.controller.controller.desiredSize) {
|
|
1876
|
+
return
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
// 2. If aborted, then:
|
|
1882
|
+
function onAborted (reason) {
|
|
1883
|
+
// 2. If fetchParams is aborted, then:
|
|
1884
|
+
if (isAborted(fetchParams)) {
|
|
1885
|
+
// 1. Set response’s aborted flag.
|
|
1886
|
+
response.aborted = true;
|
|
1887
|
+
|
|
1888
|
+
// 2. If stream is readable, then error stream with the result of
|
|
1889
|
+
// deserialize a serialized abort reason given fetchParams’s
|
|
1890
|
+
// controller’s serialized abort reason and an
|
|
1891
|
+
// implementation-defined realm.
|
|
1892
|
+
if (isReadable(stream)) {
|
|
1893
|
+
fetchParams.controller.controller.error(
|
|
1894
|
+
fetchParams.controller.serializedAbortReason
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
} else {
|
|
1898
|
+
// 3. Otherwise, if stream is readable, error stream with a TypeError.
|
|
1899
|
+
if (isReadable(stream)) {
|
|
1900
|
+
fetchParams.controller.controller.error(new TypeError('terminated', {
|
|
1901
|
+
cause: isErrorLike(reason) ? reason : undefined
|
|
1902
|
+
}));
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
// 4. If connection uses HTTP/2, then transmit an RST_STREAM frame.
|
|
1907
|
+
// 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
|
|
1908
|
+
fetchParams.controller.connection.destroy();
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// 20. Return response.
|
|
1912
|
+
return response
|
|
1913
|
+
|
|
1914
|
+
async function dispatch ({ body }) {
|
|
1915
|
+
const url = requestCurrentURL(request);
|
|
1916
|
+
/** @type {import('../..').Agent} */
|
|
1917
|
+
const agent = fetchParams.controller.dispatcher;
|
|
1918
|
+
|
|
1919
|
+
return new Promise((resolve, reject) => agent.dispatch(
|
|
1920
|
+
{
|
|
1921
|
+
path: url.pathname + url.search,
|
|
1922
|
+
origin: url.origin,
|
|
1923
|
+
method: request.method,
|
|
1924
|
+
body: fetchParams.controller.dispatcher.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
|
|
1925
|
+
headers: request.headersList.entries,
|
|
1926
|
+
maxRedirections: 0,
|
|
1927
|
+
upgrade: request.mode === 'websocket' ? 'websocket' : undefined
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
body: null,
|
|
1931
|
+
abort: null,
|
|
1932
|
+
|
|
1933
|
+
onConnect (abort) {
|
|
1934
|
+
// TODO (fix): Do we need connection here?
|
|
1935
|
+
const { connection } = fetchParams.controller;
|
|
1936
|
+
|
|
1937
|
+
if (connection.destroyed) {
|
|
1938
|
+
abort(new DOMException('The operation was aborted.', 'AbortError'));
|
|
1939
|
+
} else {
|
|
1940
|
+
fetchParams.controller.on('terminated', abort);
|
|
1941
|
+
this.abort = connection.abort = abort;
|
|
1942
|
+
}
|
|
1943
|
+
},
|
|
1944
|
+
|
|
1945
|
+
onHeaders (status, headersList, resume, statusText) {
|
|
1946
|
+
if (status < 200) {
|
|
1947
|
+
return
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
let codings = [];
|
|
1951
|
+
let location = '';
|
|
1952
|
+
|
|
1953
|
+
const headers = new Headers();
|
|
1954
|
+
|
|
1955
|
+
// For H2, the headers are a plain JS object
|
|
1956
|
+
// We distinguish between them and iterate accordingly
|
|
1957
|
+
if (Array.isArray(headersList)) {
|
|
1958
|
+
for (let n = 0; n < headersList.length; n += 2) {
|
|
1959
|
+
const key = headersList[n + 0].toString('latin1');
|
|
1960
|
+
const val = headersList[n + 1].toString('latin1');
|
|
1961
|
+
if (key.toLowerCase() === 'content-encoding') {
|
|
1962
|
+
// https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
|
|
1963
|
+
// "All content-coding values are case-insensitive..."
|
|
1964
|
+
codings = val.toLowerCase().split(',').map((x) => x.trim());
|
|
1965
|
+
} else if (key.toLowerCase() === 'location') {
|
|
1966
|
+
location = val;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
headers[kHeadersList].append(key, val);
|
|
1970
|
+
}
|
|
1971
|
+
} else {
|
|
1972
|
+
const keys = Object.keys(headersList);
|
|
1973
|
+
for (const key of keys) {
|
|
1974
|
+
const val = headersList[key];
|
|
1975
|
+
if (key.toLowerCase() === 'content-encoding') {
|
|
1976
|
+
// https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
|
|
1977
|
+
// "All content-coding values are case-insensitive..."
|
|
1978
|
+
codings = val.toLowerCase().split(',').map((x) => x.trim()).reverse();
|
|
1979
|
+
} else if (key.toLowerCase() === 'location') {
|
|
1980
|
+
location = val;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
headers[kHeadersList].append(key, val);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
this.body = new Readable({ read: resume });
|
|
1988
|
+
|
|
1989
|
+
const decoders = [];
|
|
1990
|
+
|
|
1991
|
+
const willFollow = request.redirect === 'follow' &&
|
|
1992
|
+
location &&
|
|
1993
|
+
redirectStatusSet.has(status);
|
|
1994
|
+
|
|
1995
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
|
|
1996
|
+
if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
|
|
1997
|
+
for (const coding of codings) {
|
|
1998
|
+
// https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
|
|
1999
|
+
if (coding === 'x-gzip' || coding === 'gzip') {
|
|
2000
|
+
decoders.push(zlib.createGunzip({
|
|
2001
|
+
// Be less strict when decoding compressed responses, since sometimes
|
|
2002
|
+
// servers send slightly invalid responses that are still accepted
|
|
2003
|
+
// by common browsers.
|
|
2004
|
+
// Always using Z_SYNC_FLUSH is what cURL does.
|
|
2005
|
+
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
2006
|
+
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
2007
|
+
}));
|
|
2008
|
+
} else if (coding === 'deflate') {
|
|
2009
|
+
decoders.push(zlib.createInflate());
|
|
2010
|
+
} else if (coding === 'br') {
|
|
2011
|
+
decoders.push(zlib.createBrotliDecompress());
|
|
2012
|
+
} else {
|
|
2013
|
+
decoders.length = 0;
|
|
2014
|
+
break
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
resolve({
|
|
2020
|
+
status,
|
|
2021
|
+
statusText,
|
|
2022
|
+
headersList: headers[kHeadersList],
|
|
2023
|
+
body: decoders.length
|
|
2024
|
+
? pipeline(this.body, ...decoders, () => { })
|
|
2025
|
+
: this.body.on('error', () => {})
|
|
2026
|
+
});
|
|
2027
|
+
|
|
2028
|
+
return true
|
|
2029
|
+
},
|
|
2030
|
+
|
|
2031
|
+
onData (chunk) {
|
|
2032
|
+
if (fetchParams.controller.dump) {
|
|
2033
|
+
return
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
// 1. If one or more bytes have been transmitted from response’s
|
|
2037
|
+
// message body, then:
|
|
2038
|
+
|
|
2039
|
+
// 1. Let bytes be the transmitted bytes.
|
|
2040
|
+
const bytes = chunk;
|
|
2041
|
+
|
|
2042
|
+
// 2. Let codings be the result of extracting header list values
|
|
2043
|
+
// given `Content-Encoding` and response’s header list.
|
|
2044
|
+
// See pullAlgorithm.
|
|
2045
|
+
|
|
2046
|
+
// 3. Increase timingInfo’s encoded body size by bytes’s length.
|
|
2047
|
+
timingInfo.encodedBodySize += bytes.byteLength;
|
|
2048
|
+
|
|
2049
|
+
// 4. See pullAlgorithm...
|
|
2050
|
+
|
|
2051
|
+
return this.body.push(bytes)
|
|
2052
|
+
},
|
|
2053
|
+
|
|
2054
|
+
onComplete () {
|
|
2055
|
+
if (this.abort) {
|
|
2056
|
+
fetchParams.controller.off('terminated', this.abort);
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
fetchParams.controller.ended = true;
|
|
2060
|
+
|
|
2061
|
+
this.body.push(null);
|
|
2062
|
+
},
|
|
2063
|
+
|
|
2064
|
+
onError (error) {
|
|
2065
|
+
if (this.abort) {
|
|
2066
|
+
fetchParams.controller.off('terminated', this.abort);
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
this.body?.destroy(error);
|
|
2070
|
+
|
|
2071
|
+
fetchParams.controller.terminate(error);
|
|
2072
|
+
|
|
2073
|
+
reject(error);
|
|
2074
|
+
},
|
|
2075
|
+
|
|
2076
|
+
onUpgrade (status, headersList, socket) {
|
|
2077
|
+
if (status !== 101) {
|
|
2078
|
+
return
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
const headers = new Headers();
|
|
2082
|
+
|
|
2083
|
+
for (let n = 0; n < headersList.length; n += 2) {
|
|
2084
|
+
const key = headersList[n + 0].toString('latin1');
|
|
2085
|
+
const val = headersList[n + 1].toString('latin1');
|
|
2086
|
+
|
|
2087
|
+
headers[kHeadersList].append(key, val);
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
resolve({
|
|
2091
|
+
status,
|
|
2092
|
+
statusText: STATUS_CODES[status],
|
|
2093
|
+
headersList: headers[kHeadersList],
|
|
2094
|
+
socket
|
|
2095
|
+
});
|
|
2096
|
+
|
|
2097
|
+
return true
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
))
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
fetch_1 = {
|
|
2105
|
+
fetch,
|
|
2106
|
+
Fetch,
|
|
2107
|
+
fetching,
|
|
2108
|
+
finalizeAndReportTiming
|
|
2109
|
+
};
|
|
2110
|
+
return fetch_1;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
exports.__require = requireFetch;
|
|
2114
|
+
//# sourceMappingURL=index.js.map
|