cdk-ecr-deployment 0.0.75 → 0.0.81
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/.gitattributes +20 -21
- package/.jsii +43 -35
- package/lambda/Dockerfile +25 -0
- package/lambda/install.js +64 -0
- package/lib/index.js +40 -23
- package/node_modules/@sindresorhus/is/dist/index.d.ts +225 -0
- package/node_modules/@sindresorhus/is/dist/index.js +427 -0
- package/node_modules/@sindresorhus/is/dist/types.d.ts +24 -0
- package/node_modules/@sindresorhus/is/dist/types.js +3 -0
- package/node_modules/@sindresorhus/is/license +9 -0
- package/node_modules/@sindresorhus/is/package.json +96 -0
- package/node_modules/@sindresorhus/is/readme.md +628 -0
- package/node_modules/@szmarczak/http-timer/LICENSE +21 -0
- package/node_modules/@szmarczak/http-timer/README.md +93 -0
- package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
- package/node_modules/@szmarczak/http-timer/dist/source/index.js +126 -0
- package/node_modules/@szmarczak/http-timer/package.json +72 -0
- package/node_modules/@types/cacheable-request/LICENSE +21 -0
- package/node_modules/@types/cacheable-request/README.md +16 -0
- package/node_modules/@types/cacheable-request/index.d.ts +137 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +912 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +2142 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +414 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3307 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +134 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +368 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +654 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +169 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +623 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +1091 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3784 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +284 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1369 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2100 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +391 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +131 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +2745 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +783 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +455 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +230 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +172 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +555 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1481 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +543 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +1249 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +1019 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +161 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +204 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +821 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1594 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +378 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +507 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/cacheable-request/package.json +35 -0
- package/node_modules/@types/http-cache-semantics/LICENSE +21 -0
- package/node_modules/@types/http-cache-semantics/README.md +16 -0
- package/node_modules/@types/http-cache-semantics/index.d.ts +170 -0
- package/node_modules/@types/http-cache-semantics/package.json +25 -0
- package/node_modules/@types/keyv/LICENSE +21 -0
- package/node_modules/@types/keyv/README.md +16 -0
- package/node_modules/@types/keyv/index.d.ts +77 -0
- package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +912 -0
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2142 -0
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +414 -0
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3307 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +134 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +368 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +654 -0
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +169 -0
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +623 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1091 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3784 -0
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +284 -0
- package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1369 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2100 -0
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +391 -0
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2745 -0
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +783 -0
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +455 -0
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +230 -0
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +172 -0
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +555 -0
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1481 -0
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +543 -0
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1249 -0
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1019 -0
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +161 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +204 -0
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +821 -0
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1594 -0
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +378 -0
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +507 -0
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/keyv/package.json +32 -0
- package/node_modules/@types/responselike/LICENSE +21 -0
- package/node_modules/@types/responselike/README.md +16 -0
- package/node_modules/@types/responselike/index.d.ts +34 -0
- package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +912 -0
- package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +2142 -0
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +414 -0
- package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3307 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +134 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +368 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +654 -0
- package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +169 -0
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +623 -0
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +1091 -0
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3784 -0
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +284 -0
- package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1369 -0
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2100 -0
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +391 -0
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +131 -0
- package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +2745 -0
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +783 -0
- package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +455 -0
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +230 -0
- package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +172 -0
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +555 -0
- package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1481 -0
- package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +543 -0
- package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +1249 -0
- package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +1019 -0
- package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +161 -0
- package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +204 -0
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +821 -0
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1594 -0
- package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +378 -0
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +507 -0
- package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/responselike/package.json +25 -0
- package/node_modules/cacheable-lookup/LICENSE +21 -0
- package/node_modules/cacheable-lookup/README.md +240 -0
- package/node_modules/cacheable-lookup/index.d.ts +139 -0
- package/node_modules/cacheable-lookup/package.json +45 -0
- package/node_modules/cacheable-lookup/source/index.js +436 -0
- package/node_modules/cacheable-request/LICENSE +21 -0
- package/node_modules/cacheable-request/README.md +206 -0
- package/node_modules/cacheable-request/package.json +56 -0
- package/node_modules/cacheable-request/src/index.js +251 -0
- package/node_modules/clone-response/LICENSE +21 -0
- package/node_modules/clone-response/README.md +62 -0
- package/node_modules/clone-response/package.json +44 -0
- package/node_modules/clone-response/src/index.js +17 -0
- package/node_modules/decompress-response/index.d.ts +22 -0
- package/node_modules/decompress-response/index.js +58 -0
- package/node_modules/decompress-response/license +9 -0
- package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
- package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
- package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
- package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
- package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
- package/node_modules/decompress-response/package.json +56 -0
- package/node_modules/decompress-response/readme.md +48 -0
- package/node_modules/defer-to-connect/LICENSE +21 -0
- package/node_modules/defer-to-connect/README.md +38 -0
- package/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
- package/node_modules/defer-to-connect/dist/source/index.js +47 -0
- package/node_modules/defer-to-connect/package.json +71 -0
- package/node_modules/end-of-stream/LICENSE +21 -0
- package/node_modules/end-of-stream/README.md +54 -0
- package/node_modules/end-of-stream/index.js +94 -0
- package/node_modules/end-of-stream/package.json +37 -0
- package/node_modules/get-stream/buffer-stream.js +52 -0
- package/node_modules/get-stream/index.d.ts +108 -0
- package/node_modules/get-stream/index.js +60 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/get-stream/package.json +50 -0
- package/node_modules/get-stream/readme.md +124 -0
- package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +2 -0
- package/node_modules/got/dist/source/as-promise/create-rejection.js +30 -0
- package/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
- package/node_modules/got/dist/source/as-promise/index.js +175 -0
- package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +3 -0
- package/node_modules/got/dist/source/as-promise/normalize-arguments.js +78 -0
- package/node_modules/got/dist/source/as-promise/parse-body.d.ts +3 -0
- package/node_modules/got/dist/source/as-promise/parse-body.js +25 -0
- package/node_modules/got/dist/source/as-promise/types.d.ts +256 -0
- package/node_modules/got/dist/source/as-promise/types.js +40 -0
- package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +5 -0
- package/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
- package/node_modules/got/dist/source/core/index.d.ts +1124 -0
- package/node_modules/got/dist/source/core/index.js +1491 -0
- package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
- package/node_modules/got/dist/source/core/utils/dns-ip-version.js +17 -0
- package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
- package/node_modules/got/dist/source/core/utils/get-body-size.js +32 -0
- package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +4 -0
- package/node_modules/got/dist/source/core/utils/get-buffer.js +16 -0
- package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
- package/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
- package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +2 -0
- package/node_modules/got/dist/source/core/utils/is-response-ok.js +8 -0
- package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +14 -0
- package/node_modules/got/dist/source/core/utils/options-to-url.js +53 -0
- package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
- package/node_modules/got/dist/source/core/utils/proxy-events.js +17 -0
- package/node_modules/got/dist/source/core/utils/timed-out.d.ts +29 -0
- package/node_modules/got/dist/source/core/utils/timed-out.js +121 -0
- package/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
- package/node_modules/got/dist/source/core/utils/unhandle.js +22 -0
- package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
- package/node_modules/got/dist/source/core/utils/url-to-options.js +24 -0
- package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
- package/node_modules/got/dist/source/core/utils/weakable-map.js +29 -0
- package/node_modules/got/dist/source/create.d.ts +5 -0
- package/node_modules/got/dist/source/create.js +240 -0
- package/node_modules/got/dist/source/index.d.ts +4 -0
- package/node_modules/got/dist/source/index.js +132 -0
- package/node_modules/got/dist/source/types.d.ts +342 -0
- package/node_modules/got/dist/source/types.js +2 -0
- package/node_modules/got/dist/source/utils/deep-freeze.d.ts +1 -0
- package/node_modules/got/dist/source/utils/deep-freeze.js +12 -0
- package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +2 -0
- package/node_modules/got/dist/source/utils/deprecation-warning.js +13 -0
- package/node_modules/got/license +9 -0
- package/node_modules/got/package.json +130 -0
- package/node_modules/got/readme.md +2476 -0
- package/node_modules/http-cache-semantics/LICENSE +9 -0
- package/node_modules/http-cache-semantics/README.md +203 -0
- package/node_modules/http-cache-semantics/index.js +673 -0
- package/node_modules/http-cache-semantics/package.json +24 -0
- package/node_modules/http2-wrapper/LICENSE +21 -0
- package/node_modules/http2-wrapper/README.md +470 -0
- package/node_modules/http2-wrapper/package.json +54 -0
- package/node_modules/http2-wrapper/source/agent.js +670 -0
- package/node_modules/http2-wrapper/source/auto.js +149 -0
- package/node_modules/http2-wrapper/source/client-request.js +445 -0
- package/node_modules/http2-wrapper/source/incoming-message.js +58 -0
- package/node_modules/http2-wrapper/source/index.js +28 -0
- package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +27 -0
- package/node_modules/http2-wrapper/source/utils/errors.js +45 -0
- package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
- package/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
- package/node_modules/http2-wrapper/source/utils/url-to-options.js +25 -0
- package/node_modules/json-buffer/.travis.yml +3 -0
- package/node_modules/json-buffer/LICENSE +22 -0
- package/node_modules/json-buffer/README.md +24 -0
- package/node_modules/json-buffer/index.js +58 -0
- package/node_modules/json-buffer/package.json +34 -0
- package/node_modules/json-buffer/test/index.js +63 -0
- package/node_modules/keyv/LICENSE +21 -0
- package/node_modules/keyv/README.md +288 -0
- package/node_modules/keyv/package.json +49 -0
- package/node_modules/keyv/src/index.js +111 -0
- package/node_modules/lowercase-keys/index.d.ts +16 -0
- package/node_modules/lowercase-keys/index.js +10 -0
- package/node_modules/lowercase-keys/license +9 -0
- package/node_modules/lowercase-keys/package.json +38 -0
- package/node_modules/lowercase-keys/readme.md +32 -0
- package/node_modules/mimic-response/index.js +32 -0
- package/node_modules/mimic-response/license +9 -0
- package/node_modules/mimic-response/package.json +37 -0
- package/node_modules/mimic-response/readme.md +54 -0
- package/node_modules/normalize-url/index.d.ts +267 -0
- package/node_modules/normalize-url/index.js +216 -0
- package/node_modules/normalize-url/license +9 -0
- package/node_modules/normalize-url/package.json +50 -0
- package/node_modules/normalize-url/readme.md +286 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +33 -0
- package/node_modules/p-cancelable/index.d.ts +176 -0
- package/node_modules/p-cancelable/index.js +111 -0
- package/node_modules/p-cancelable/license +9 -0
- package/node_modules/p-cancelable/package.json +49 -0
- package/node_modules/p-cancelable/readme.md +153 -0
- package/node_modules/pump/.travis.yml +5 -0
- package/node_modules/pump/LICENSE +21 -0
- package/node_modules/pump/README.md +65 -0
- package/node_modules/pump/index.js +82 -0
- package/node_modules/pump/package.json +24 -0
- package/node_modules/pump/test-browser.js +66 -0
- package/node_modules/pump/test-node.js +53 -0
- package/node_modules/quick-lru/index.d.ts +97 -0
- package/node_modules/quick-lru/index.js +123 -0
- package/node_modules/quick-lru/license +9 -0
- package/node_modules/quick-lru/package.json +43 -0
- package/node_modules/quick-lru/readme.md +111 -0
- package/node_modules/resolve-alpn/LICENSE +22 -0
- package/node_modules/resolve-alpn/README.md +60 -0
- package/node_modules/resolve-alpn/index.js +43 -0
- package/node_modules/resolve-alpn/package.json +34 -0
- package/node_modules/responselike/LICENSE +19 -0
- package/node_modules/responselike/README.md +77 -0
- package/node_modules/responselike/package.json +38 -0
- package/node_modules/responselike/src/index.js +34 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +29 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/package.json +41 -38
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const resolveALPN = require('resolve-alpn');
|
|
5
|
+
const QuickLRU = require('quick-lru');
|
|
6
|
+
const Http2ClientRequest = require('./client-request');
|
|
7
|
+
const calculateServerName = require('./utils/calculate-server-name');
|
|
8
|
+
const urlToOptions = require('./utils/url-to-options');
|
|
9
|
+
|
|
10
|
+
const cache = new QuickLRU({maxSize: 100});
|
|
11
|
+
const queue = new Map();
|
|
12
|
+
|
|
13
|
+
const installSocket = (agent, socket, options) => {
|
|
14
|
+
socket._httpMessage = {shouldKeepAlive: true};
|
|
15
|
+
|
|
16
|
+
const onFree = () => {
|
|
17
|
+
agent.emit('free', socket, options);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
socket.on('free', onFree);
|
|
21
|
+
|
|
22
|
+
const onClose = () => {
|
|
23
|
+
agent.removeSocket(socket, options);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
socket.on('close', onClose);
|
|
27
|
+
|
|
28
|
+
const onRemove = () => {
|
|
29
|
+
agent.removeSocket(socket, options);
|
|
30
|
+
socket.off('close', onClose);
|
|
31
|
+
socket.off('free', onFree);
|
|
32
|
+
socket.off('agentRemove', onRemove);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
socket.on('agentRemove', onRemove);
|
|
36
|
+
|
|
37
|
+
agent.emit('free', socket, options);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const resolveProtocol = async options => {
|
|
41
|
+
const name = `${options.host}:${options.port}:${options.ALPNProtocols.sort()}`;
|
|
42
|
+
|
|
43
|
+
if (!cache.has(name)) {
|
|
44
|
+
if (queue.has(name)) {
|
|
45
|
+
const result = await queue.get(name);
|
|
46
|
+
return result.alpnProtocol;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const {path, agent} = options;
|
|
50
|
+
options.path = options.socketPath;
|
|
51
|
+
|
|
52
|
+
const resultPromise = resolveALPN(options);
|
|
53
|
+
queue.set(name, resultPromise);
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const {socket, alpnProtocol} = await resultPromise;
|
|
57
|
+
cache.set(name, alpnProtocol);
|
|
58
|
+
|
|
59
|
+
options.path = path;
|
|
60
|
+
|
|
61
|
+
if (alpnProtocol === 'h2') {
|
|
62
|
+
// https://github.com/nodejs/node/issues/33343
|
|
63
|
+
socket.destroy();
|
|
64
|
+
} else {
|
|
65
|
+
const {globalAgent} = https;
|
|
66
|
+
const defaultCreateConnection = https.Agent.prototype.createConnection;
|
|
67
|
+
|
|
68
|
+
if (agent) {
|
|
69
|
+
if (agent.createConnection === defaultCreateConnection) {
|
|
70
|
+
installSocket(agent, socket, options);
|
|
71
|
+
} else {
|
|
72
|
+
socket.destroy();
|
|
73
|
+
}
|
|
74
|
+
} else if (globalAgent.createConnection === defaultCreateConnection) {
|
|
75
|
+
installSocket(globalAgent, socket, options);
|
|
76
|
+
} else {
|
|
77
|
+
socket.destroy();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
queue.delete(name);
|
|
82
|
+
|
|
83
|
+
return alpnProtocol;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
queue.delete(name);
|
|
86
|
+
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return cache.get(name);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
module.exports = async (input, options, callback) => {
|
|
95
|
+
if (typeof input === 'string' || input instanceof URL) {
|
|
96
|
+
input = urlToOptions(new URL(input));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (typeof options === 'function') {
|
|
100
|
+
callback = options;
|
|
101
|
+
options = undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
options = {
|
|
105
|
+
ALPNProtocols: ['h2', 'http/1.1'],
|
|
106
|
+
...input,
|
|
107
|
+
...options,
|
|
108
|
+
resolveSocket: true
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
if (!Array.isArray(options.ALPNProtocols) || options.ALPNProtocols.length === 0) {
|
|
112
|
+
throw new Error('The `ALPNProtocols` option must be an Array with at least one entry');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
options.protocol = options.protocol || 'https:';
|
|
116
|
+
const isHttps = options.protocol === 'https:';
|
|
117
|
+
|
|
118
|
+
options.host = options.hostname || options.host || 'localhost';
|
|
119
|
+
options.session = options.tlsSession;
|
|
120
|
+
options.servername = options.servername || calculateServerName(options);
|
|
121
|
+
options.port = options.port || (isHttps ? 443 : 80);
|
|
122
|
+
options._defaultAgent = isHttps ? https.globalAgent : http.globalAgent;
|
|
123
|
+
|
|
124
|
+
const agents = options.agent;
|
|
125
|
+
|
|
126
|
+
if (agents) {
|
|
127
|
+
if (agents.addRequest) {
|
|
128
|
+
throw new Error('The `options.agent` object can contain only `http`, `https` or `http2` properties');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
options.agent = agents[isHttps ? 'https' : 'http'];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (isHttps) {
|
|
135
|
+
const protocol = await resolveProtocol(options);
|
|
136
|
+
|
|
137
|
+
if (protocol === 'h2') {
|
|
138
|
+
if (agents) {
|
|
139
|
+
options.agent = agents.http2;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return new Http2ClientRequest(options, callback);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return http.request(options, callback);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
module.exports.protocolCache = cache;
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const http2 = require('http2');
|
|
3
|
+
const {Writable} = require('stream');
|
|
4
|
+
const {Agent, globalAgent} = require('./agent');
|
|
5
|
+
const IncomingMessage = require('./incoming-message');
|
|
6
|
+
const urlToOptions = require('./utils/url-to-options');
|
|
7
|
+
const proxyEvents = require('./utils/proxy-events');
|
|
8
|
+
const isRequestPseudoHeader = require('./utils/is-request-pseudo-header');
|
|
9
|
+
const {
|
|
10
|
+
ERR_INVALID_ARG_TYPE,
|
|
11
|
+
ERR_INVALID_PROTOCOL,
|
|
12
|
+
ERR_HTTP_HEADERS_SENT,
|
|
13
|
+
ERR_INVALID_HTTP_TOKEN,
|
|
14
|
+
ERR_HTTP_INVALID_HEADER_VALUE,
|
|
15
|
+
ERR_INVALID_CHAR
|
|
16
|
+
} = require('./utils/errors');
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
HTTP2_HEADER_STATUS,
|
|
20
|
+
HTTP2_HEADER_METHOD,
|
|
21
|
+
HTTP2_HEADER_PATH,
|
|
22
|
+
HTTP2_METHOD_CONNECT
|
|
23
|
+
} = http2.constants;
|
|
24
|
+
|
|
25
|
+
const kHeaders = Symbol('headers');
|
|
26
|
+
const kOrigin = Symbol('origin');
|
|
27
|
+
const kSession = Symbol('session');
|
|
28
|
+
const kOptions = Symbol('options');
|
|
29
|
+
const kFlushedHeaders = Symbol('flushedHeaders');
|
|
30
|
+
const kJobs = Symbol('jobs');
|
|
31
|
+
|
|
32
|
+
const isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/;
|
|
33
|
+
const isInvalidHeaderValue = /[^\t\u0020-\u007E\u0080-\u00FF]/;
|
|
34
|
+
|
|
35
|
+
class ClientRequest extends Writable {
|
|
36
|
+
constructor(input, options, callback) {
|
|
37
|
+
super({
|
|
38
|
+
autoDestroy: false
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const hasInput = typeof input === 'string' || input instanceof URL;
|
|
42
|
+
if (hasInput) {
|
|
43
|
+
input = urlToOptions(input instanceof URL ? input : new URL(input));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeof options === 'function' || options === undefined) {
|
|
47
|
+
// (options, callback)
|
|
48
|
+
callback = options;
|
|
49
|
+
options = hasInput ? input : {...input};
|
|
50
|
+
} else {
|
|
51
|
+
// (input, options, callback)
|
|
52
|
+
options = {...input, ...options};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (options.h2session) {
|
|
56
|
+
this[kSession] = options.h2session;
|
|
57
|
+
} else if (options.agent === false) {
|
|
58
|
+
this.agent = new Agent({maxFreeSessions: 0});
|
|
59
|
+
} else if (typeof options.agent === 'undefined' || options.agent === null) {
|
|
60
|
+
if (typeof options.createConnection === 'function') {
|
|
61
|
+
// This is a workaround - we don't have to create the session on our own.
|
|
62
|
+
this.agent = new Agent({maxFreeSessions: 0});
|
|
63
|
+
this.agent.createConnection = options.createConnection;
|
|
64
|
+
} else {
|
|
65
|
+
this.agent = globalAgent;
|
|
66
|
+
}
|
|
67
|
+
} else if (typeof options.agent.request === 'function') {
|
|
68
|
+
this.agent = options.agent;
|
|
69
|
+
} else {
|
|
70
|
+
throw new ERR_INVALID_ARG_TYPE('options.agent', ['Agent-like Object', 'undefined', 'false'], options.agent);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (options.protocol && options.protocol !== 'https:') {
|
|
74
|
+
throw new ERR_INVALID_PROTOCOL(options.protocol, 'https:');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const port = options.port || options.defaultPort || (this.agent && this.agent.defaultPort) || 443;
|
|
78
|
+
const host = options.hostname || options.host || 'localhost';
|
|
79
|
+
|
|
80
|
+
// Don't enforce the origin via options. It may be changed in an Agent.
|
|
81
|
+
delete options.hostname;
|
|
82
|
+
delete options.host;
|
|
83
|
+
delete options.port;
|
|
84
|
+
|
|
85
|
+
const {timeout} = options;
|
|
86
|
+
options.timeout = undefined;
|
|
87
|
+
|
|
88
|
+
this[kHeaders] = Object.create(null);
|
|
89
|
+
this[kJobs] = [];
|
|
90
|
+
|
|
91
|
+
this.socket = null;
|
|
92
|
+
this.connection = null;
|
|
93
|
+
|
|
94
|
+
this.method = options.method || 'GET';
|
|
95
|
+
this.path = options.path;
|
|
96
|
+
|
|
97
|
+
this.res = null;
|
|
98
|
+
this.aborted = false;
|
|
99
|
+
this.reusedSocket = false;
|
|
100
|
+
|
|
101
|
+
if (options.headers) {
|
|
102
|
+
for (const [header, value] of Object.entries(options.headers)) {
|
|
103
|
+
this.setHeader(header, value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (options.auth && !('authorization' in this[kHeaders])) {
|
|
108
|
+
this[kHeaders].authorization = 'Basic ' + Buffer.from(options.auth).toString('base64');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
options.session = options.tlsSession;
|
|
112
|
+
options.path = options.socketPath;
|
|
113
|
+
|
|
114
|
+
this[kOptions] = options;
|
|
115
|
+
|
|
116
|
+
// Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field.
|
|
117
|
+
if (port === 443) {
|
|
118
|
+
this[kOrigin] = `https://${host}`;
|
|
119
|
+
|
|
120
|
+
if (!(':authority' in this[kHeaders])) {
|
|
121
|
+
this[kHeaders][':authority'] = host;
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
this[kOrigin] = `https://${host}:${port}`;
|
|
125
|
+
|
|
126
|
+
if (!(':authority' in this[kHeaders])) {
|
|
127
|
+
this[kHeaders][':authority'] = `${host}:${port}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (timeout) {
|
|
132
|
+
this.setTimeout(timeout);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (callback) {
|
|
136
|
+
this.once('response', callback);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this[kFlushedHeaders] = false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
get method() {
|
|
143
|
+
return this[kHeaders][HTTP2_HEADER_METHOD];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
set method(value) {
|
|
147
|
+
if (value) {
|
|
148
|
+
this[kHeaders][HTTP2_HEADER_METHOD] = value.toUpperCase();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get path() {
|
|
153
|
+
return this[kHeaders][HTTP2_HEADER_PATH];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
set path(value) {
|
|
157
|
+
if (value) {
|
|
158
|
+
this[kHeaders][HTTP2_HEADER_PATH] = value;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
get _mustNotHaveABody() {
|
|
163
|
+
return this.method === 'GET' || this.method === 'HEAD' || this.method === 'DELETE';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
_write(chunk, encoding, callback) {
|
|
167
|
+
// https://github.com/nodejs/node/blob/654df09ae0c5e17d1b52a900a545f0664d8c7627/lib/internal/http2/util.js#L148-L156
|
|
168
|
+
if (this._mustNotHaveABody) {
|
|
169
|
+
callback(new Error('The GET, HEAD and DELETE methods must NOT have a body'));
|
|
170
|
+
/* istanbul ignore next: Node.js 12 throws directly */
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this.flushHeaders();
|
|
175
|
+
|
|
176
|
+
const callWrite = () => this._request.write(chunk, encoding, callback);
|
|
177
|
+
if (this._request) {
|
|
178
|
+
callWrite();
|
|
179
|
+
} else {
|
|
180
|
+
this[kJobs].push(callWrite);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
_final(callback) {
|
|
185
|
+
if (this.destroyed) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
this.flushHeaders();
|
|
190
|
+
|
|
191
|
+
const callEnd = () => {
|
|
192
|
+
// For GET, HEAD and DELETE
|
|
193
|
+
if (this._mustNotHaveABody) {
|
|
194
|
+
callback();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
this._request.end(callback);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
if (this._request) {
|
|
202
|
+
callEnd();
|
|
203
|
+
} else {
|
|
204
|
+
this[kJobs].push(callEnd);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
abort() {
|
|
209
|
+
if (this.res && this.res.complete) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (!this.aborted) {
|
|
214
|
+
process.nextTick(() => this.emit('abort'));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.aborted = true;
|
|
218
|
+
|
|
219
|
+
this.destroy();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
_destroy(error, callback) {
|
|
223
|
+
if (this.res) {
|
|
224
|
+
this.res._dump();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (this._request) {
|
|
228
|
+
this._request.destroy();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
callback(error);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
async flushHeaders() {
|
|
235
|
+
if (this[kFlushedHeaders] || this.destroyed) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
this[kFlushedHeaders] = true;
|
|
240
|
+
|
|
241
|
+
const isConnectMethod = this.method === HTTP2_METHOD_CONNECT;
|
|
242
|
+
|
|
243
|
+
// The real magic is here
|
|
244
|
+
const onStream = stream => {
|
|
245
|
+
this._request = stream;
|
|
246
|
+
|
|
247
|
+
if (this.destroyed) {
|
|
248
|
+
stream.destroy();
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Forwards `timeout`, `continue`, `close` and `error` events to this instance.
|
|
253
|
+
if (!isConnectMethod) {
|
|
254
|
+
proxyEvents(stream, this, ['timeout', 'continue', 'close', 'error']);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Wait for the `finish` event. We don't want to emit the `response` event
|
|
258
|
+
// before `request.end()` is called.
|
|
259
|
+
const waitForEnd = fn => {
|
|
260
|
+
return (...args) => {
|
|
261
|
+
if (!this.writable && !this.destroyed) {
|
|
262
|
+
fn(...args);
|
|
263
|
+
} else {
|
|
264
|
+
this.once('finish', () => {
|
|
265
|
+
fn(...args);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// This event tells we are ready to listen for the data.
|
|
272
|
+
stream.once('response', waitForEnd((headers, flags, rawHeaders) => {
|
|
273
|
+
// If we were to emit raw request stream, it would be as fast as the native approach.
|
|
274
|
+
// Note that wrapping the raw stream in a Proxy instance won't improve the performance (already tested it).
|
|
275
|
+
const response = new IncomingMessage(this.socket, stream.readableHighWaterMark);
|
|
276
|
+
this.res = response;
|
|
277
|
+
|
|
278
|
+
response.req = this;
|
|
279
|
+
response.statusCode = headers[HTTP2_HEADER_STATUS];
|
|
280
|
+
response.headers = headers;
|
|
281
|
+
response.rawHeaders = rawHeaders;
|
|
282
|
+
|
|
283
|
+
response.once('end', () => {
|
|
284
|
+
if (this.aborted) {
|
|
285
|
+
response.aborted = true;
|
|
286
|
+
response.emit('aborted');
|
|
287
|
+
} else {
|
|
288
|
+
response.complete = true;
|
|
289
|
+
|
|
290
|
+
// Has no effect, just be consistent with the Node.js behavior
|
|
291
|
+
response.socket = null;
|
|
292
|
+
response.connection = null;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
if (isConnectMethod) {
|
|
297
|
+
response.upgrade = true;
|
|
298
|
+
|
|
299
|
+
// The HTTP1 API says the socket is detached here,
|
|
300
|
+
// but we can't do that so we pass the original HTTP2 request.
|
|
301
|
+
if (this.emit('connect', response, stream, Buffer.alloc(0))) {
|
|
302
|
+
this.emit('close');
|
|
303
|
+
} else {
|
|
304
|
+
// No listeners attached, destroy the original request.
|
|
305
|
+
stream.destroy();
|
|
306
|
+
}
|
|
307
|
+
} else {
|
|
308
|
+
// Forwards data
|
|
309
|
+
stream.on('data', chunk => {
|
|
310
|
+
if (!response._dumped && !response.push(chunk)) {
|
|
311
|
+
stream.pause();
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
stream.once('end', () => {
|
|
316
|
+
response.push(null);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
if (!this.emit('response', response)) {
|
|
320
|
+
// No listeners attached, dump the response.
|
|
321
|
+
response._dump();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}));
|
|
325
|
+
|
|
326
|
+
// Emits `information` event
|
|
327
|
+
stream.once('headers', waitForEnd(
|
|
328
|
+
headers => this.emit('information', {statusCode: headers[HTTP2_HEADER_STATUS]})
|
|
329
|
+
));
|
|
330
|
+
|
|
331
|
+
stream.once('trailers', waitForEnd((trailers, flags, rawTrailers) => {
|
|
332
|
+
const {res} = this;
|
|
333
|
+
|
|
334
|
+
// Assigns trailers to the response object.
|
|
335
|
+
res.trailers = trailers;
|
|
336
|
+
res.rawTrailers = rawTrailers;
|
|
337
|
+
}));
|
|
338
|
+
|
|
339
|
+
const {socket} = stream.session;
|
|
340
|
+
this.socket = socket;
|
|
341
|
+
this.connection = socket;
|
|
342
|
+
|
|
343
|
+
for (const job of this[kJobs]) {
|
|
344
|
+
job();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.emit('socket', this.socket);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// Makes a HTTP2 request
|
|
351
|
+
if (this[kSession]) {
|
|
352
|
+
try {
|
|
353
|
+
onStream(this[kSession].request(this[kHeaders]));
|
|
354
|
+
} catch (error) {
|
|
355
|
+
this.emit('error', error);
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
this.reusedSocket = true;
|
|
359
|
+
|
|
360
|
+
try {
|
|
361
|
+
onStream(await this.agent.request(this[kOrigin], this[kOptions], this[kHeaders]));
|
|
362
|
+
} catch (error) {
|
|
363
|
+
this.emit('error', error);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
getHeader(name) {
|
|
369
|
+
if (typeof name !== 'string') {
|
|
370
|
+
throw new ERR_INVALID_ARG_TYPE('name', 'string', name);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return this[kHeaders][name.toLowerCase()];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
get headersSent() {
|
|
377
|
+
return this[kFlushedHeaders];
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
removeHeader(name) {
|
|
381
|
+
if (typeof name !== 'string') {
|
|
382
|
+
throw new ERR_INVALID_ARG_TYPE('name', 'string', name);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (this.headersSent) {
|
|
386
|
+
throw new ERR_HTTP_HEADERS_SENT('remove');
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
delete this[kHeaders][name.toLowerCase()];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
setHeader(name, value) {
|
|
393
|
+
if (this.headersSent) {
|
|
394
|
+
throw new ERR_HTTP_HEADERS_SENT('set');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (typeof name !== 'string' || (!isValidHttpToken.test(name) && !isRequestPseudoHeader(name))) {
|
|
398
|
+
throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (typeof value === 'undefined') {
|
|
402
|
+
throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (isInvalidHeaderValue.test(value)) {
|
|
406
|
+
throw new ERR_INVALID_CHAR('header content', name);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
this[kHeaders][name.toLowerCase()] = value;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
setNoDelay() {
|
|
413
|
+
// HTTP2 sockets cannot be malformed, do nothing.
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
setSocketKeepAlive() {
|
|
417
|
+
// HTTP2 sockets cannot be malformed, do nothing.
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
setTimeout(ms, callback) {
|
|
421
|
+
const applyTimeout = () => this._request.setTimeout(ms, callback);
|
|
422
|
+
|
|
423
|
+
if (this._request) {
|
|
424
|
+
applyTimeout();
|
|
425
|
+
} else {
|
|
426
|
+
this[kJobs].push(applyTimeout);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return this;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
get maxHeadersCount() {
|
|
433
|
+
if (!this.destroyed && this._request) {
|
|
434
|
+
return this._request.session.localSettings.maxHeaderListSize;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return undefined;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
set maxHeadersCount(_value) {
|
|
441
|
+
// Updating HTTP2 settings would affect all requests, do nothing.
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
module.exports = ClientRequest;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const {Readable} = require('stream');
|
|
3
|
+
|
|
4
|
+
class IncomingMessage extends Readable {
|
|
5
|
+
constructor(socket, highWaterMark) {
|
|
6
|
+
super({
|
|
7
|
+
highWaterMark,
|
|
8
|
+
autoDestroy: false
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
this.statusCode = null;
|
|
12
|
+
this.statusMessage = '';
|
|
13
|
+
this.httpVersion = '2.0';
|
|
14
|
+
this.httpVersionMajor = 2;
|
|
15
|
+
this.httpVersionMinor = 0;
|
|
16
|
+
this.headers = {};
|
|
17
|
+
this.trailers = {};
|
|
18
|
+
this.req = null;
|
|
19
|
+
|
|
20
|
+
this.aborted = false;
|
|
21
|
+
this.complete = false;
|
|
22
|
+
this.upgrade = null;
|
|
23
|
+
|
|
24
|
+
this.rawHeaders = [];
|
|
25
|
+
this.rawTrailers = [];
|
|
26
|
+
|
|
27
|
+
this.socket = socket;
|
|
28
|
+
this.connection = socket;
|
|
29
|
+
|
|
30
|
+
this._dumped = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_destroy(error) {
|
|
34
|
+
this.req._request.destroy(error);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setTimeout(ms, callback) {
|
|
38
|
+
this.req.setTimeout(ms, callback);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_dump() {
|
|
43
|
+
if (!this._dumped) {
|
|
44
|
+
this._dumped = true;
|
|
45
|
+
|
|
46
|
+
this.removeAllListeners('data');
|
|
47
|
+
this.resume();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_read() {
|
|
52
|
+
if (this.req) {
|
|
53
|
+
this.req._request.resume();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = IncomingMessage;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const http2 = require('http2');
|
|
3
|
+
const agent = require('./agent');
|
|
4
|
+
const ClientRequest = require('./client-request');
|
|
5
|
+
const IncomingMessage = require('./incoming-message');
|
|
6
|
+
const auto = require('./auto');
|
|
7
|
+
|
|
8
|
+
const request = (url, options, callback) => {
|
|
9
|
+
return new ClientRequest(url, options, callback);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const get = (url, options, callback) => {
|
|
13
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
14
|
+
const req = new ClientRequest(url, options, callback);
|
|
15
|
+
req.end();
|
|
16
|
+
|
|
17
|
+
return req;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
...http2,
|
|
22
|
+
ClientRequest,
|
|
23
|
+
IncomingMessage,
|
|
24
|
+
...agent,
|
|
25
|
+
request,
|
|
26
|
+
get,
|
|
27
|
+
auto
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const net = require('net');
|
|
3
|
+
/* istanbul ignore file: https://github.com/nodejs/node/blob/v13.0.1/lib/_http_agent.js */
|
|
4
|
+
|
|
5
|
+
module.exports = options => {
|
|
6
|
+
let servername = options.host;
|
|
7
|
+
const hostHeader = options.headers && options.headers.host;
|
|
8
|
+
|
|
9
|
+
if (hostHeader) {
|
|
10
|
+
if (hostHeader.startsWith('[')) {
|
|
11
|
+
const index = hostHeader.indexOf(']');
|
|
12
|
+
if (index === -1) {
|
|
13
|
+
servername = hostHeader;
|
|
14
|
+
} else {
|
|
15
|
+
servername = hostHeader.slice(1, -1);
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
servername = hostHeader.split(':', 1)[0];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (net.isIP(servername)) {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return servername;
|
|
27
|
+
};
|