cdk-ecr-deployment 0.0.76 → 0.0.79
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/.jsii +28 -25
- 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 +1365 -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 +128 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +357 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +643 -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 +1004 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3748 -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 +1368 -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 +2738 -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 +1477 -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 +542 -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 +798 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1563 -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 +1365 -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 +128 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +357 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +643 -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 +1004 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3748 -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 +1368 -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 +2738 -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 +1477 -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 +542 -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 +798 -0
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1563 -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 +1365 -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 +128 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +357 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +643 -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 +1004 -0
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3748 -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 +1368 -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 +2738 -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 +1477 -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 +542 -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 +798 -0
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1563 -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 +7 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Szymon Marczak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
# http2-wrapper
|
|
2
|
+
> HTTP/2 client, just with the familiar `https` API
|
|
3
|
+
|
|
4
|
+
[](https://github.com/szmarczak/http2-wrapper/actions)
|
|
5
|
+
[](https://codecov.io/gh/szmarczak/http2-wrapper)
|
|
6
|
+
[](https://www.npmjs.com/package/http2-wrapper)
|
|
7
|
+
[](https://packagephobia.now.sh/result?p=http2-wrapper)
|
|
8
|
+
|
|
9
|
+
This package was created to support HTTP/2 without the need to rewrite your code.<br>
|
|
10
|
+
I recommend adapting to the [`http2`](https://nodejs.org/api/http2.html) module if possible - it's much simpler to use and has many cool features!
|
|
11
|
+
|
|
12
|
+
**Tip**: `http2-wrapper` is very useful when you rely on other modules that use the HTTP/1 API and you want to support HTTP/2.
|
|
13
|
+
|
|
14
|
+
**Pro Tip**: While the native `http2` doesn't have agents yet, you can use `http2-wrapper` Agents and still operate on the native HTTP/2 streams.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
> `$ npm install http2-wrapper`<br>
|
|
19
|
+
> `$ yarn add http2-wrapper`
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
```js
|
|
23
|
+
const http2 = require('http2-wrapper');
|
|
24
|
+
|
|
25
|
+
const options = {
|
|
26
|
+
hostname: 'nghttp2.org',
|
|
27
|
+
protocol: 'https:',
|
|
28
|
+
path: '/httpbin/post',
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
'content-length': 6
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const request = http2.request(options, response => {
|
|
36
|
+
console.log('statusCode:', response.statusCode);
|
|
37
|
+
console.log('headers:', response.headers);
|
|
38
|
+
|
|
39
|
+
const body = [];
|
|
40
|
+
response.on('data', chunk => {
|
|
41
|
+
body.push(chunk);
|
|
42
|
+
});
|
|
43
|
+
response.on('end', () => {
|
|
44
|
+
console.log('body:', Buffer.concat(body).toString());
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
request.on('error', console.error);
|
|
49
|
+
|
|
50
|
+
request.write('123');
|
|
51
|
+
request.end('456');
|
|
52
|
+
|
|
53
|
+
// statusCode: 200
|
|
54
|
+
// headers: [Object: null prototype] {
|
|
55
|
+
// ':status': 200,
|
|
56
|
+
// date: 'Fri, 27 Sep 2019 19:45:46 GMT',
|
|
57
|
+
// 'content-type': 'application/json',
|
|
58
|
+
// 'access-control-allow-origin': '*',
|
|
59
|
+
// 'access-control-allow-credentials': 'true',
|
|
60
|
+
// 'content-length': '239',
|
|
61
|
+
// 'x-backend-header-rtt': '0.002516',
|
|
62
|
+
// 'strict-transport-security': 'max-age=31536000',
|
|
63
|
+
// server: 'nghttpx',
|
|
64
|
+
// via: '1.1 nghttpx',
|
|
65
|
+
// 'alt-svc': 'h3-23=":4433"; ma=3600',
|
|
66
|
+
// 'x-frame-options': 'SAMEORIGIN',
|
|
67
|
+
// 'x-xss-protection': '1; mode=block',
|
|
68
|
+
// 'x-content-type-options': 'nosniff'
|
|
69
|
+
// }
|
|
70
|
+
// body: {
|
|
71
|
+
// "args": {},
|
|
72
|
+
// "data": "123456",
|
|
73
|
+
// "files": {},
|
|
74
|
+
// "form": {},
|
|
75
|
+
// "headers": {
|
|
76
|
+
// "Content-Length": "6",
|
|
77
|
+
// "Host": "nghttp2.org"
|
|
78
|
+
// },
|
|
79
|
+
// "json": 123456,
|
|
80
|
+
// "origin": "xxx.xxx.xxx.xxx",
|
|
81
|
+
// "url": "https://nghttp2.org/httpbin/post"
|
|
82
|
+
// }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## API
|
|
86
|
+
|
|
87
|
+
**Note:** The `session` option was renamed to `tlsSession` for better readability.
|
|
88
|
+
|
|
89
|
+
### http2.auto(url, options, callback)
|
|
90
|
+
|
|
91
|
+
Performs [ALPN](https://nodejs.org/api/tls.html#tls_alpn_and_sni) negotiation.
|
|
92
|
+
Returns a Promise giving proper `ClientRequest` instance (depending on the ALPN).
|
|
93
|
+
|
|
94
|
+
**Note**: The `agent` option represents an object with `http`, `https` and `http2` properties.
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
const http2 = require('http2-wrapper');
|
|
98
|
+
|
|
99
|
+
const options = {
|
|
100
|
+
hostname: 'httpbin.org',
|
|
101
|
+
protocol: 'http:', // Note the `http:` protocol here
|
|
102
|
+
path: '/post',
|
|
103
|
+
method: 'POST',
|
|
104
|
+
headers: {
|
|
105
|
+
'content-length': 6
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
(async () => {
|
|
110
|
+
try {
|
|
111
|
+
const request = await http2.auto(options, response => {
|
|
112
|
+
console.log('statusCode:', response.statusCode);
|
|
113
|
+
console.log('headers:', response.headers);
|
|
114
|
+
|
|
115
|
+
const body = [];
|
|
116
|
+
response.on('data', chunk => body.push(chunk));
|
|
117
|
+
response.on('end', () => {
|
|
118
|
+
console.log('body:', Buffer.concat(body).toString());
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
request.on('error', console.error);
|
|
123
|
+
|
|
124
|
+
request.write('123');
|
|
125
|
+
request.end('456');
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error(error);
|
|
128
|
+
}
|
|
129
|
+
})();
|
|
130
|
+
|
|
131
|
+
// statusCode: 200
|
|
132
|
+
// headers: { connection: 'close',
|
|
133
|
+
// server: 'gunicorn/19.9.0',
|
|
134
|
+
// date: 'Sat, 15 Dec 2018 18:19:32 GMT',
|
|
135
|
+
// 'content-type': 'application/json',
|
|
136
|
+
// 'content-length': '259',
|
|
137
|
+
// 'access-control-allow-origin': '*',
|
|
138
|
+
// 'access-control-allow-credentials': 'true',
|
|
139
|
+
// via: '1.1 vegur' }
|
|
140
|
+
// body: {
|
|
141
|
+
// "args": {},
|
|
142
|
+
// "data": "123456",
|
|
143
|
+
// "files": {},
|
|
144
|
+
// "form": {},
|
|
145
|
+
// "headers": {
|
|
146
|
+
// "Connection": "close",
|
|
147
|
+
// "Content-Length": "6",
|
|
148
|
+
// "Host": "httpbin.org"
|
|
149
|
+
// },
|
|
150
|
+
// "json": 123456,
|
|
151
|
+
// "origin": "xxx.xxx.xxx.xxx",
|
|
152
|
+
// "url": "http://httpbin.org/post"
|
|
153
|
+
// }
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### http2.auto.protocolCache
|
|
157
|
+
|
|
158
|
+
An instance of [`quick-lru`](https://github.com/sindresorhus/quick-lru) used for ALPN cache.
|
|
159
|
+
|
|
160
|
+
There is a maximum of 100 entries. You can modify the limit through `protocolCache.maxSize` - note that the change will be visible globally.
|
|
161
|
+
|
|
162
|
+
### http2.request(url, options, callback)
|
|
163
|
+
|
|
164
|
+
Same as [`https.request`](https://nodejs.org/api/https.html#https_https_request_options_callback).
|
|
165
|
+
|
|
166
|
+
##### options.h2session
|
|
167
|
+
|
|
168
|
+
Type: `Http2Session`<br>
|
|
169
|
+
|
|
170
|
+
The session used to make the actual request. If none provided, it will use `options.agent`.
|
|
171
|
+
|
|
172
|
+
### http2.get(url, options, callback)
|
|
173
|
+
|
|
174
|
+
Same as [`https.get`](https://nodejs.org/api/https.html#https_https_get_options_callback).
|
|
175
|
+
|
|
176
|
+
### new http2.ClientRequest(url, options, callback)
|
|
177
|
+
|
|
178
|
+
Same as [`https.ClientRequest`](https://nodejs.org/api/https.html#https_class_https_clientrequest).
|
|
179
|
+
|
|
180
|
+
### new http2.IncomingMessage(socket)
|
|
181
|
+
|
|
182
|
+
Same as [`https.IncomingMessage`](https://nodejs.org/api/https.html#https_class_https_incomingmessage).
|
|
183
|
+
|
|
184
|
+
### new http2.Agent(options)
|
|
185
|
+
|
|
186
|
+
**Note:** this is **not** compatible with the classic `http.Agent`.
|
|
187
|
+
|
|
188
|
+
Usage example:
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
const http2 = require('http2-wrapper');
|
|
192
|
+
|
|
193
|
+
class MyAgent extends http2.Agent {
|
|
194
|
+
createConnection(origin, options) {
|
|
195
|
+
console.log(`Connecting to ${http2.Agent.normalizeOrigin(origin)}`);
|
|
196
|
+
return http2.Agent.connect(origin, options);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
http2.get({
|
|
201
|
+
hostname: 'google.com',
|
|
202
|
+
agent: new MyAgent()
|
|
203
|
+
}, res => {
|
|
204
|
+
res.on('data', chunk => console.log(`Received chunk of ${chunk.length} bytes`));
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### options
|
|
209
|
+
|
|
210
|
+
Each option is assigned to each `Agent` instance and can be changed later.
|
|
211
|
+
|
|
212
|
+
##### timeout
|
|
213
|
+
|
|
214
|
+
Type: `number`<br>
|
|
215
|
+
Default: `60000`
|
|
216
|
+
|
|
217
|
+
If there's no activity after `timeout` milliseconds, the session will be closed.
|
|
218
|
+
|
|
219
|
+
##### maxSessions
|
|
220
|
+
|
|
221
|
+
Type: `number`<br>
|
|
222
|
+
Default: `Infinity`
|
|
223
|
+
|
|
224
|
+
The maximum amount of sessions in total.
|
|
225
|
+
|
|
226
|
+
##### maxFreeSessions
|
|
227
|
+
|
|
228
|
+
Type: `number`<br>
|
|
229
|
+
Default: `10`
|
|
230
|
+
|
|
231
|
+
The maximum amount of free sessions in total. This only applies to sessions with no pending requests.
|
|
232
|
+
|
|
233
|
+
**Note:** It is possible that the amount will be exceeded when sessions have at least 1 pending request.
|
|
234
|
+
|
|
235
|
+
##### maxCachedTlsSessions
|
|
236
|
+
|
|
237
|
+
Type: `number`<br>
|
|
238
|
+
Default: `100`
|
|
239
|
+
|
|
240
|
+
The maximum amount of cached TLS sessions.
|
|
241
|
+
|
|
242
|
+
#### Agent.normalizeOrigin(url)
|
|
243
|
+
|
|
244
|
+
Returns a string representing the origin of the URL.
|
|
245
|
+
|
|
246
|
+
#### agent.settings
|
|
247
|
+
|
|
248
|
+
Type: `object`<br>
|
|
249
|
+
Default: `{enablePush: false}`
|
|
250
|
+
|
|
251
|
+
[Settings](https://nodejs.org/api/http2.html#http2_settings_object) used by the current agent instance.
|
|
252
|
+
|
|
253
|
+
#### agent.normalizeOptions([options](https://github.com/szmarczak/http2-wrapper/blob/master/source/agent.js))
|
|
254
|
+
|
|
255
|
+
Returns a string representing normalized options.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
Agent.normalizeOptions({servername: 'example.com'});
|
|
259
|
+
// => ':example.com'
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### agent.getSession(origin, options)
|
|
263
|
+
|
|
264
|
+
##### [origin](https://nodejs.org/api/http2.html#http2_http2_connect_authority_options_listener)
|
|
265
|
+
|
|
266
|
+
Type: `string` `URL` `object`
|
|
267
|
+
|
|
268
|
+
An origin used to create new session.
|
|
269
|
+
|
|
270
|
+
##### [options](https://nodejs.org/api/http2.html#http2_http2_connect_authority_options_listener)
|
|
271
|
+
|
|
272
|
+
Type: `object`
|
|
273
|
+
|
|
274
|
+
The options used to create new session.
|
|
275
|
+
|
|
276
|
+
Returns a Promise giving free `Http2Session`. If no free sessions are found, a new one is created.
|
|
277
|
+
|
|
278
|
+
#### agent.getSession([origin](#origin), [options](options-1), listener)
|
|
279
|
+
|
|
280
|
+
##### listener
|
|
281
|
+
|
|
282
|
+
Type: `object`
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
{
|
|
286
|
+
reject: error => void,
|
|
287
|
+
resolve: session => void
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
If the `listener` argument is present, the Promise will resolve immediately. It will use the `resolve` function to pass the session.
|
|
292
|
+
|
|
293
|
+
#### agent.request([origin](#origin), [options](#options-1), [headers](https://nodejs.org/api/http2.html#http2_headers_object), [streamOptions](https://nodejs.org/api/http2.html#http2_clienthttp2session_request_headers_options))
|
|
294
|
+
|
|
295
|
+
Returns a Promise giving `Http2Stream`.
|
|
296
|
+
|
|
297
|
+
#### agent.createConnection([origin](#origin), [options](#options-1))
|
|
298
|
+
|
|
299
|
+
Returns a new `TLSSocket`. It defaults to `Agent.connect(origin, options)`.
|
|
300
|
+
|
|
301
|
+
#### agent.closeFreeSessions()
|
|
302
|
+
|
|
303
|
+
Makes an attempt to close free sessions. Only sessions with 0 concurrent streams will be closed.
|
|
304
|
+
|
|
305
|
+
#### agent.destroy(reason)
|
|
306
|
+
|
|
307
|
+
Destroys **all** sessions.
|
|
308
|
+
|
|
309
|
+
#### Event: 'session'
|
|
310
|
+
|
|
311
|
+
```js
|
|
312
|
+
agent.on('session', session => {
|
|
313
|
+
// A new session has been created by the Agent.
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Proxy support
|
|
318
|
+
|
|
319
|
+
An example of a full-featured proxy server can be found [here](examples/proxy/server.js). It supports **mirroring, custom authorities and the CONNECT protocol**.
|
|
320
|
+
|
|
321
|
+
### Mirroring
|
|
322
|
+
|
|
323
|
+
To mirror another server we need to use only [`http2-proxy`](https://github.com/nxtedition/node-http2-proxy). We don't need the CONNECT protocol or custom authorities.
|
|
324
|
+
|
|
325
|
+
To see the result, just navigate to the server's address.
|
|
326
|
+
|
|
327
|
+
### HTTP/1 over HTTP/2
|
|
328
|
+
|
|
329
|
+
Since we don't care about mirroring, the server needs to support the CONNECT protocol in this case.
|
|
330
|
+
|
|
331
|
+
The client looks like this:
|
|
332
|
+
|
|
333
|
+
```js
|
|
334
|
+
const https = require('https');
|
|
335
|
+
const http2 = require('http2');
|
|
336
|
+
|
|
337
|
+
const session = http2.connect('https://localhost:8000', {
|
|
338
|
+
// For demo purposes only!
|
|
339
|
+
rejectUnauthorized: false
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
session.ref();
|
|
343
|
+
|
|
344
|
+
https.request('https://httpbin.org/anything', {
|
|
345
|
+
createConnection: options => {
|
|
346
|
+
return session.request({
|
|
347
|
+
':method': 'CONNECT',
|
|
348
|
+
':authority': `${options.host}:${options.port}`
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}, response => {
|
|
352
|
+
console.log('statusCode:', response.statusCode);
|
|
353
|
+
console.log('headers:', response.headers);
|
|
354
|
+
|
|
355
|
+
const body = [];
|
|
356
|
+
response.on('data', chunk => {
|
|
357
|
+
body.push(chunk);
|
|
358
|
+
});
|
|
359
|
+
response.on('end', () => {
|
|
360
|
+
console.log('body:', Buffer.concat(body).toString());
|
|
361
|
+
|
|
362
|
+
session.unref();
|
|
363
|
+
});
|
|
364
|
+
}).end();
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### HTTP/2 over HTTP/2
|
|
368
|
+
|
|
369
|
+
It's a tricky one! We cannot create an HTTP/2 session on top of an HTTP/2 stream. But... we can still specify the `:authority` header, no need to use the CONNECT protocol here.
|
|
370
|
+
|
|
371
|
+
The client looks like this:
|
|
372
|
+
|
|
373
|
+
```js
|
|
374
|
+
const http2 = require('../../source');
|
|
375
|
+
const {Agent} = http2;
|
|
376
|
+
|
|
377
|
+
class ProxyAgent extends Agent {
|
|
378
|
+
constructor(url, options) {
|
|
379
|
+
super(options);
|
|
380
|
+
|
|
381
|
+
this.origin = url;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
request(origin, sessionOptions, headers, streamOptions) {
|
|
385
|
+
return super.request(this.origin, sessionOptions, {
|
|
386
|
+
...headers,
|
|
387
|
+
':authority': (new URL(origin)).host
|
|
388
|
+
}, streamOptions);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const request = http2.request({
|
|
393
|
+
hostname: 'httpbin.org',
|
|
394
|
+
protocol: 'https:',
|
|
395
|
+
path: '/anything',
|
|
396
|
+
agent: new ProxyAgent('https://localhost:8000'),
|
|
397
|
+
// For demo purposes only!
|
|
398
|
+
rejectUnauthorized: false
|
|
399
|
+
}, response => {
|
|
400
|
+
console.log('statusCode:', response.statusCode);
|
|
401
|
+
console.log('headers:', response.headers);
|
|
402
|
+
|
|
403
|
+
const body = [];
|
|
404
|
+
response.on('data', chunk => {
|
|
405
|
+
body.push(chunk);
|
|
406
|
+
});
|
|
407
|
+
response.on('end', () => {
|
|
408
|
+
console.log('body:', Buffer.concat(body).toString());
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
request.on('error', console.error);
|
|
413
|
+
|
|
414
|
+
request.end();
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Notes
|
|
418
|
+
|
|
419
|
+
- If you're interested in [WebSockets over HTTP/2](https://tools.ietf.org/html/rfc8441), then [check out this discussion](https://github.com/websockets/ws/issues/1458).
|
|
420
|
+
- [HTTP/2 sockets cannot be malformed](https://github.com/nodejs/node/blob/cc8250fab86486632fdeb63892be735d7628cd13/lib/internal/http2/core.js#L725), therefore modifying the socket will have no effect.
|
|
421
|
+
- You can make [a custom Agent](examples/push-stream/index.js) to support push streams.
|
|
422
|
+
|
|
423
|
+
## Benchmarks
|
|
424
|
+
|
|
425
|
+
CPU: Intel i7-7700k (governor: performance)<br>
|
|
426
|
+
Server: H2O v2.2.5 [`h2o.conf`](h2o.conf)<br>
|
|
427
|
+
Node: v14.5.0
|
|
428
|
+
Linux: 5.6.18-156.current
|
|
429
|
+
|
|
430
|
+
`auto` means `http2wrapper.auto`.
|
|
431
|
+
|
|
432
|
+
```
|
|
433
|
+
http2-wrapper x 12,181 ops/sec ±3.39% (75 runs sampled)
|
|
434
|
+
http2-wrapper - preconfigured session x 13,140 ops/sec ±2.51% (79 runs sampled)
|
|
435
|
+
http2-wrapper - auto x 11,412 ops/sec ±2.55% (78 runs sampled)
|
|
436
|
+
http2 x 16,050 ops/sec ±1.39% (86 runs sampled)
|
|
437
|
+
https - auto - keepalive x 12,288 ops/sec ±2.69% (79 runs sampled)
|
|
438
|
+
https - keepalive x 12,155 ops/sec ±3.32% (78 runs sampled)
|
|
439
|
+
https x 1,604 ops/sec ±2.03% (77 runs sampled)
|
|
440
|
+
http x 6,041 ops/sec ±3.82% (76 runs sampled)
|
|
441
|
+
Fastest is http2
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
`http2-wrapper`:
|
|
445
|
+
- 32% **less** performant than `http2`
|
|
446
|
+
- as performant as `https - keepalive`
|
|
447
|
+
- 100% **more** performant than `http`
|
|
448
|
+
|
|
449
|
+
`http2-wrapper - preconfigured session`:
|
|
450
|
+
- 22% **less** performant than `http2`
|
|
451
|
+
- 8% **more** performant than `https - keepalive`
|
|
452
|
+
- 118% **more** performant than `http`
|
|
453
|
+
|
|
454
|
+
`http2-wrapper - auto`:
|
|
455
|
+
- 41% **less** performant than `http2`
|
|
456
|
+
- 8% **less** performant than `https - keepalive`
|
|
457
|
+
- 89% **more** performant than `http`
|
|
458
|
+
|
|
459
|
+
`https - auto - keepalive`:
|
|
460
|
+
- 31% **less** performant than `http2`
|
|
461
|
+
- as performant as `https - keepalive`
|
|
462
|
+
- 103% **more** performant than `http`
|
|
463
|
+
|
|
464
|
+
## Related
|
|
465
|
+
|
|
466
|
+
- [`got`](https://github.com/sindresorhus/got) - Simplified HTTP requests
|
|
467
|
+
|
|
468
|
+
## License
|
|
469
|
+
|
|
470
|
+
MIT
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "http2-wrapper",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "HTTP2 client, just with the familiar `https` API",
|
|
5
|
+
"main": "source",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=10.19.0"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"source"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"http2",
|
|
17
|
+
"https",
|
|
18
|
+
"http",
|
|
19
|
+
"request"
|
|
20
|
+
],
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/szmarczak/http2-wrapper.git"
|
|
24
|
+
},
|
|
25
|
+
"author": "Szymon Marczak",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/szmarczak/http2-wrapper/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/szmarczak/http2-wrapper#readme",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"quick-lru": "^5.1.1",
|
|
33
|
+
"resolve-alpn": "^1.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@sindresorhus/is": "^3.0.0",
|
|
37
|
+
"ava": "^3.10.1",
|
|
38
|
+
"benchmark": "^2.1.4",
|
|
39
|
+
"get-stream": "^5.1.0",
|
|
40
|
+
"got": "^11.5.0",
|
|
41
|
+
"http2-proxy": "^5.0.51",
|
|
42
|
+
"lolex": "^6.0.0",
|
|
43
|
+
"many-keys-map": "^1.0.2",
|
|
44
|
+
"nyc": "^15.1.0",
|
|
45
|
+
"p-event": "^4.2.0",
|
|
46
|
+
"tempy": "^0.5.0",
|
|
47
|
+
"to-readable-stream": "^2.1.0",
|
|
48
|
+
"tsd": "^0.13.1",
|
|
49
|
+
"xo": "^0.32.1"
|
|
50
|
+
},
|
|
51
|
+
"ava": {
|
|
52
|
+
"timeout": "2m"
|
|
53
|
+
}
|
|
54
|
+
}
|