@emulsify/cli 1.9.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -13
- package/dist/node_modules/.package-lock.json +38 -25
- package/dist/node_modules/@types/node/README.md +5 -6
- package/dist/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/dist/node_modules/@types/node/assert.d.ts +955 -45
- package/dist/node_modules/@types/node/async_hooks.d.ts +391 -87
- package/dist/node_modules/@types/node/buffer.d.ts +2210 -17
- package/dist/node_modules/@types/node/child_process.d.ts +1051 -189
- package/dist/node_modules/@types/node/cluster.d.ts +421 -143
- package/dist/node_modules/@types/node/console.d.ts +359 -49
- package/dist/node_modules/@types/node/constants.d.ts +3 -3
- package/dist/node_modules/@types/node/crypto.d.ts +3528 -291
- package/dist/node_modules/@types/node/dgram.d.ts +446 -30
- package/dist/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/dist/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/dist/node_modules/@types/node/dns.d.ts +588 -240
- package/dist/node_modules/@types/node/dom-events.d.ts +124 -0
- package/dist/node_modules/@types/node/domain.d.ts +159 -16
- package/dist/node_modules/@types/node/events.d.ts +890 -41
- package/dist/node_modules/@types/node/fs/promises.d.ts +980 -369
- package/dist/node_modules/@types/node/fs.d.ts +2599 -869
- package/dist/node_modules/@types/node/globals.d.ts +374 -727
- package/dist/node_modules/@types/node/globals.global.d.ts +1 -1
- package/dist/node_modules/@types/node/http.d.ts +1459 -132
- package/dist/node_modules/@types/node/http2.d.ts +1333 -123
- package/dist/node_modules/@types/node/https.d.ts +289 -13
- package/dist/node_modules/@types/node/index.d.ts +37 -46
- package/dist/node_modules/@types/node/inspector.d.ts +367 -671
- package/dist/node_modules/@types/node/module.d.ts +273 -14
- package/dist/node_modules/@types/node/net.d.ts +741 -66
- package/dist/node_modules/@types/node/os.d.ts +275 -23
- package/dist/node_modules/@types/node/package.json +95 -110
- package/dist/node_modules/@types/node/path.d.ts +27 -4
- package/dist/node_modules/@types/node/perf_hooks.d.ts +756 -125
- package/dist/node_modules/@types/node/process.d.ts +1429 -127
- package/dist/node_modules/@types/node/punycode.d.ts +65 -26
- package/dist/node_modules/@types/node/querystring.d.ts +121 -9
- package/dist/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/dist/node_modules/@types/node/readline.d.ts +405 -49
- package/dist/node_modules/@types/node/repl.d.ts +99 -73
- package/dist/node_modules/@types/node/sea.d.ts +153 -0
- package/dist/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/dist/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/dist/node_modules/@types/node/stream/web.d.ts +367 -0
- package/dist/node_modules/@types/node/stream.d.ts +1462 -273
- package/dist/node_modules/@types/node/string_decoder.d.ts +59 -2
- package/dist/node_modules/@types/node/test.d.ts +1719 -0
- package/dist/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/dist/node_modules/@types/node/timers.d.ts +233 -12
- package/dist/node_modules/@types/node/tls.d.ts +540 -189
- package/dist/node_modules/@types/node/trace_events.d.ts +143 -10
- package/dist/node_modules/@types/node/tty.d.ts +156 -17
- package/dist/node_modules/@types/node/url.d.ts +812 -47
- package/dist/node_modules/@types/node/util.d.ts +2159 -145
- package/dist/node_modules/@types/node/v8.d.ts +693 -74
- package/dist/node_modules/@types/node/vm.d.ts +813 -44
- package/dist/node_modules/@types/node/wasi.d.ts +121 -28
- package/dist/node_modules/@types/node/worker_threads.d.ts +514 -61
- package/dist/node_modules/@types/node/zlib.d.ts +220 -54
- package/dist/node_modules/ajv-formats/node_modules/ajv/README.md +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js +1 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts +2 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts +3 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.d.ts +10 -10
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js +5 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts +1 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts +2 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts +2 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts +3 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts +10 -10
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts +4 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/package.json +5 -5
- package/dist/node_modules/commander/Readme.md +10 -8
- package/dist/node_modules/commander/esm.mjs +1 -1
- package/dist/node_modules/commander/lib/argument.js +9 -5
- package/dist/node_modules/commander/lib/command.js +406 -196
- package/dist/node_modules/commander/lib/error.js +0 -4
- package/dist/node_modules/commander/lib/help.js +101 -38
- package/dist/node_modules/commander/lib/option.js +11 -8
- package/dist/node_modules/commander/lib/suggestSimilar.js +5 -4
- package/dist/node_modules/commander/package.json +23 -19
- package/dist/node_modules/commander/typings/index.d.ts +110 -40
- package/dist/node_modules/debug/package.json +4 -3
- package/dist/node_modules/debug/src/browser.js +3 -1
- package/dist/node_modules/debug/src/node.js +2 -2
- package/dist/node_modules/fast-uri/.gitattributes +2 -0
- package/dist/node_modules/fast-uri/.github/.stale.yml +21 -0
- package/dist/node_modules/fast-uri/.github/dependabot.yml +13 -0
- package/dist/node_modules/fast-uri/.github/tests_checker.yml +8 -0
- package/dist/node_modules/fast-uri/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +20 -0
- package/dist/node_modules/fast-uri/.taprc +3 -0
- package/dist/node_modules/fast-uri/LICENSE +30 -0
- package/dist/node_modules/fast-uri/README.md +125 -0
- package/dist/node_modules/fast-uri/benchmark.js +105 -0
- package/dist/node_modules/fast-uri/index.js +309 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +188 -0
- package/dist/node_modules/fast-uri/lib/scopedChars.js +30 -0
- package/dist/node_modules/fast-uri/lib/utils.js +242 -0
- package/dist/node_modules/fast-uri/package.json +39 -0
- package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
- package/dist/node_modules/fast-uri/test/ajv.test.js +39 -0
- package/dist/node_modules/fast-uri/test/compatibility.test.js +130 -0
- package/dist/node_modules/fast-uri/test/equal.test.js +104 -0
- package/dist/node_modules/fast-uri/test/parse.test.js +319 -0
- package/dist/node_modules/fast-uri/test/resolve.test.js +76 -0
- package/dist/node_modules/fast-uri/test/serialize.test.js +144 -0
- package/dist/node_modules/fast-uri/test/uri-js.test.js +940 -0
- package/dist/node_modules/fast-uri/test/util.test.js +24 -0
- package/dist/node_modules/fast-uri/types/index.d.ts +53 -0
- package/dist/node_modules/fast-uri/types/index.test-d.ts +17 -0
- package/dist/node_modules/fs-extra/README.md +32 -2
- package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +3 -11
- package/dist/node_modules/fs-extra/lib/copy/copy.js +120 -178
- package/dist/node_modules/fs-extra/lib/copy/index.js +1 -1
- package/dist/node_modules/fs-extra/lib/ensure/file.js +31 -34
- package/dist/node_modules/fs-extra/lib/ensure/link.js +27 -27
- package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +57 -55
- package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +16 -13
- package/dist/node_modules/fs-extra/lib/ensure/symlink.js +29 -44
- package/dist/node_modules/fs-extra/lib/esm.mjs +68 -0
- package/dist/node_modules/fs-extra/lib/fs/index.js +29 -17
- package/dist/node_modules/fs-extra/lib/move/index.js +1 -1
- package/dist/node_modules/fs-extra/lib/move/move-sync.js +2 -1
- package/dist/node_modules/fs-extra/lib/move/move.js +38 -54
- package/dist/node_modules/fs-extra/lib/output-file/index.js +10 -19
- package/dist/node_modules/fs-extra/lib/remove/index.js +2 -7
- package/dist/node_modules/fs-extra/lib/util/stat.js +46 -42
- package/dist/node_modules/fs-extra/lib/util/utimes.js +21 -11
- package/dist/node_modules/fs-extra/package.json +11 -7
- package/dist/node_modules/simple-git/dist/cjs/index.js +4958 -0
- package/dist/node_modules/simple-git/dist/cjs/index.js.map +7 -0
- package/dist/node_modules/simple-git/dist/esm/index.js +4813 -0
- package/dist/node_modules/simple-git/dist/esm/index.js.map +7 -0
- package/dist/node_modules/simple-git/dist/esm/package.json +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/api.d.ts +3 -13
- package/dist/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/args/pathspec.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/git-error.d.ts +3 -2
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/git-factory.d.ts +15 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-branch.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-list-log-summary.d.ts +2 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-pull.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/completion-detection.plugin.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/index.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +11 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/progress-monitor-plugin.d.ts +1 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/simple-git-plugin.d.ts +10 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/timout-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +14 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/FileStatusSummary.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +25 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/StatusSummary.d.ts +2 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/git-executor-chain.d.ts +1 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/git-executor.d.ts +3 -4
- package/dist/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/clone.d.ts +3 -2
- package/dist/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +4 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/config.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +5 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/fetch.d.ts +2 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/log.d.ts +3 -3
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/remote.d.ts +3 -3
- package/dist/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +4 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/task.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +9 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/types/index.d.ts +64 -5
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/exit-codes.d.ts +1 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/line-parser.d.ts +1 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/task-parser.d.ts +2 -2
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/util.d.ts +3 -1
- package/dist/node_modules/simple-git/{typings → dist/typings}/errors.d.ts +0 -1
- package/dist/node_modules/simple-git/{typings → dist/typings}/index.d.ts +2 -1
- package/dist/node_modules/simple-git/{typings → dist/typings}/response.d.ts +68 -25
- package/dist/node_modules/simple-git/{typings → dist/typings}/simple-git.d.ts +493 -110
- package/dist/node_modules/simple-git/dist/typings/types.d.ts +23 -0
- package/dist/node_modules/simple-git/package.json +32 -35
- package/dist/node_modules/simple-git/promise.js +14 -4
- package/dist/node_modules/simple-git/readme.md +372 -389
- package/dist/node_modules/undici-types/README.md +6 -0
- package/dist/node_modules/undici-types/agent.d.ts +31 -0
- package/dist/node_modules/undici-types/api.d.ts +43 -0
- package/dist/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/dist/node_modules/undici-types/cache.d.ts +36 -0
- package/dist/node_modules/undici-types/client.d.ts +97 -0
- package/dist/node_modules/undici-types/connector.d.ts +34 -0
- package/dist/node_modules/undici-types/content-type.d.ts +21 -0
- package/dist/node_modules/undici-types/cookies.d.ts +28 -0
- package/dist/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/dist/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/dist/node_modules/undici-types/errors.d.ts +128 -0
- package/dist/node_modules/undici-types/fetch.d.ts +209 -0
- package/dist/node_modules/undici-types/file.d.ts +39 -0
- package/dist/node_modules/undici-types/filereader.d.ts +54 -0
- package/dist/node_modules/undici-types/formdata.d.ts +108 -0
- package/dist/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/dist/node_modules/undici-types/global-origin.d.ts +7 -0
- package/dist/node_modules/undici-types/handlers.d.ts +9 -0
- package/dist/node_modules/undici-types/header.d.ts +4 -0
- package/dist/node_modules/undici-types/index.d.ts +63 -0
- package/dist/node_modules/undici-types/interceptors.d.ts +5 -0
- package/dist/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/dist/node_modules/undici-types/mock-client.d.ts +25 -0
- package/dist/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/dist/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/dist/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/dist/node_modules/undici-types/package.json +55 -0
- package/dist/node_modules/undici-types/patch.d.ts +71 -0
- package/dist/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/dist/node_modules/undici-types/pool.d.ts +28 -0
- package/dist/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/dist/node_modules/undici-types/readable.d.ts +61 -0
- package/dist/node_modules/undici-types/webidl.d.ts +220 -0
- package/dist/node_modules/undici-types/websocket.d.ts +131 -0
- package/dist/package-lock.json +10146 -0
- package/dist/package.json +24 -24
- package/dist/schemas/variant.json +5 -21
- package/package.json +24 -24
- package/dist/node_modules/@types/node/ts4.8/assert.d.ts +0 -130
- package/dist/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -237
- package/dist/node_modules/@types/node/ts4.8/buffer.d.ts +0 -89
- package/dist/node_modules/@types/node/ts4.8/child_process.d.ts +0 -682
- package/dist/node_modules/@types/node/ts4.8/cluster.d.ts +0 -300
- package/dist/node_modules/@types/node/ts4.8/console.d.ts +0 -142
- package/dist/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
- package/dist/node_modules/@types/node/ts4.8/crypto.d.ts +0 -1287
- package/dist/node_modules/@types/node/ts4.8/dgram.d.ts +0 -180
- package/dist/node_modules/@types/node/ts4.8/dns.d.ts +0 -516
- package/dist/node_modules/@types/node/ts4.8/domain.d.ts +0 -27
- package/dist/node_modules/@types/node/ts4.8/events.d.ts +0 -82
- package/dist/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -634
- package/dist/node_modules/@types/node/ts4.8/fs.d.ts +0 -2587
- package/dist/node_modules/@types/node/ts4.8/globals.d.ts +0 -763
- package/dist/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/dist/node_modules/@types/node/ts4.8/http.d.ts +0 -580
- package/dist/node_modules/@types/node/ts4.8/http2.d.ts +0 -1208
- package/dist/node_modules/@types/node/ts4.8/https.d.ts +0 -274
- package/dist/node_modules/@types/node/ts4.8/index.d.ts +0 -53
- package/dist/node_modules/@types/node/ts4.8/inspector.d.ts +0 -3050
- package/dist/node_modules/@types/node/ts4.8/module.d.ts +0 -56
- package/dist/node_modules/@types/node/ts4.8/net.d.ts +0 -324
- package/dist/node_modules/@types/node/ts4.8/os.d.ts +0 -243
- package/dist/node_modules/@types/node/ts4.8/path.d.ts +0 -168
- package/dist/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -274
- package/dist/node_modules/@types/node/ts4.8/process.d.ts +0 -452
- package/dist/node_modules/@types/node/ts4.8/punycode.d.ts +0 -78
- package/dist/node_modules/@types/node/ts4.8/querystring.d.ts +0 -41
- package/dist/node_modules/@types/node/ts4.8/readline.d.ts +0 -184
- package/dist/node_modules/@types/node/ts4.8/repl.d.ts +0 -404
- package/dist/node_modules/@types/node/ts4.8/stream.d.ts +0 -518
- package/dist/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -10
- package/dist/node_modules/@types/node/ts4.8/timers.d.ts +0 -19
- package/dist/node_modules/@types/node/ts4.8/tls.d.ts +0 -866
- package/dist/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -64
- package/dist/node_modules/@types/node/ts4.8/tty.d.ts +0 -69
- package/dist/node_modules/@types/node/ts4.8/url.d.ts +0 -187
- package/dist/node_modules/@types/node/ts4.8/util.d.ts +0 -278
- package/dist/node_modules/@types/node/ts4.8/v8.d.ts +0 -189
- package/dist/node_modules/@types/node/ts4.8/vm.d.ts +0 -155
- package/dist/node_modules/@types/node/ts4.8/wasi.d.ts +0 -88
- package/dist/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -241
- package/dist/node_modules/@types/node/ts4.8/zlib.d.ts +0 -364
- package/dist/node_modules/fs-extra/lib/remove/rimraf.js +0 -302
- package/dist/node_modules/simple-git/CHANGELOG.md +0 -529
- package/dist/node_modules/simple-git/LICENSE +0 -20
- package/dist/node_modules/simple-git/promise.d.ts +0 -46
- package/dist/node_modules/simple-git/src/git.js +0 -700
- package/dist/node_modules/simple-git/src/index.js +0 -7
- package/dist/node_modules/simple-git/src/lib/api.js +0 -26
- package/dist/node_modules/simple-git/src/lib/api.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-construct-error.js +0 -21
- package/dist/node_modules/simple-git/src/lib/errors/git-construct-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-error.js +0 -37
- package/dist/node_modules/simple-git/src/lib/errors/git-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-plugin-error.d.ts +0 -6
- package/dist/node_modules/simple-git/src/lib/errors/git-plugin-error.js +0 -14
- package/dist/node_modules/simple-git/src/lib/errors/git-plugin-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-response-error.js +0 -36
- package/dist/node_modules/simple-git/src/lib/errors/git-response-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/task-configuration-error.js +0 -19
- package/dist/node_modules/simple-git/src/lib/errors/task-configuration-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/git-factory.d.ts +0 -25
- package/dist/node_modules/simple-git/src/lib/git-factory.js +0 -45
- package/dist/node_modules/simple-git/src/lib/git-factory.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/git-logger.js +0 -101
- package/dist/node_modules/simple-git/src/lib/git-logger.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch-delete.js +0 -29
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch-delete.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch.js +0 -18
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-commit.js +0 -53
- package/dist/node_modules/simple-git/src/lib/parsers/parse-commit.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-diff-summary.d.ts +0 -2
- package/dist/node_modules/simple-git/src/lib/parsers/parse-diff-summary.js +0 -74
- package/dist/node_modules/simple-git/src/lib/parsers/parse-diff-summary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-fetch.js +0 -32
- package/dist/node_modules/simple-git/src/lib/parsers/parse-fetch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-list-log-summary.js +0 -35
- package/dist/node_modules/simple-git/src/lib/parsers/parse-list-log-summary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-merge.js +0 -39
- package/dist/node_modules/simple-git/src/lib/parsers/parse-merge.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-move.js +0 -14
- package/dist/node_modules/simple-git/src/lib/parsers/parse-move.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-pull.js +0 -42
- package/dist/node_modules/simple-git/src/lib/parsers/parse-pull.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-push.js +0 -58
- package/dist/node_modules/simple-git/src/lib/parsers/parse-push.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-messages.js +0 -33
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-messages.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-objects.js +0 -41
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-objects.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/command-config-prefixing-plugin.js +0 -15
- package/dist/node_modules/simple-git/src/lib/plugins/command-config-prefixing-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/completion-detection.plugin.js +0 -80
- package/dist/node_modules/simple-git/src/lib/plugins/completion-detection.plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/error-detection.plugin.js +0 -39
- package/dist/node_modules/simple-git/src/lib/plugins/error-detection.plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/index.js +0 -21
- package/dist/node_modules/simple-git/src/lib/plugins/index.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/plugin-store.d.ts +0 -6
- package/dist/node_modules/simple-git/src/lib/plugins/plugin-store.js +0 -28
- package/dist/node_modules/simple-git/src/lib/plugins/plugin-store.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/progress-monitor-plugin.js +0 -45
- package/dist/node_modules/simple-git/src/lib/plugins/progress-monitor-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/simple-git-plugin.js +0 -3
- package/dist/node_modules/simple-git/src/lib/plugins/simple-git-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/spawn-options-plugin.js +0 -15
- package/dist/node_modules/simple-git/src/lib/plugins/spawn-options-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/timout-plugin.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/plugins/timout-plugin.js +0 -37
- package/dist/node_modules/simple-git/src/lib/plugins/timout-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/BranchDeleteSummary.js +0 -31
- package/dist/node_modules/simple-git/src/lib/responses/BranchDeleteSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/BranchSummary.d.ts +0 -10
- package/dist/node_modules/simple-git/src/lib/responses/BranchSummary.js +0 -26
- package/dist/node_modules/simple-git/src/lib/responses/BranchSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/CheckIgnore.js +0 -13
- package/dist/node_modules/simple-git/src/lib/responses/CheckIgnore.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/CleanSummary.js +0 -28
- package/dist/node_modules/simple-git/src/lib/responses/CleanSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/ConfigList.js +0 -89
- package/dist/node_modules/simple-git/src/lib/responses/ConfigList.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/DiffSummary.js +0 -16
- package/dist/node_modules/simple-git/src/lib/responses/DiffSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/FileStatusSummary.js +0 -18
- package/dist/node_modules/simple-git/src/lib/responses/FileStatusSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/GetRemoteSummary.js +0 -30
- package/dist/node_modules/simple-git/src/lib/responses/GetRemoteSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/InitSummary.js +0 -36
- package/dist/node_modules/simple-git/src/lib/responses/InitSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/MergeSummary.js +0 -35
- package/dist/node_modules/simple-git/src/lib/responses/MergeSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/PullSummary.d.ts +0 -12
- package/dist/node_modules/simple-git/src/lib/responses/PullSummary.js +0 -22
- package/dist/node_modules/simple-git/src/lib/responses/PullSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/StatusSummary.js +0 -128
- package/dist/node_modules/simple-git/src/lib/responses/StatusSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/TagList.js +0 -56
- package/dist/node_modules/simple-git/src/lib/responses/TagList.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/git-executor-chain.js +0 -173
- package/dist/node_modules/simple-git/src/lib/runners/git-executor-chain.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/git-executor.js +0 -21
- package/dist/node_modules/simple-git/src/lib/runners/git-executor.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/promise-wrapped.js +0 -133
- package/dist/node_modules/simple-git/src/lib/runners/promise-wrapped.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/scheduler.js +0 -48
- package/dist/node_modules/simple-git/src/lib/runners/scheduler.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/tasks-pending-queue.js +0 -64
- package/dist/node_modules/simple-git/src/lib/runners/tasks-pending-queue.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/simple-git-api.js +0 -80
- package/dist/node_modules/simple-git/src/lib/simple-git-api.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/task-callback.js +0 -39
- package/dist/node_modules/simple-git/src/lib/task-callback.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/apply-patch.js +0 -9
- package/dist/node_modules/simple-git/src/lib/tasks/apply-patch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/branch.js +0 -76
- package/dist/node_modules/simple-git/src/lib/tasks/branch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/change-working-directory.js +0 -15
- package/dist/node_modules/simple-git/src/lib/tasks/change-working-directory.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/check-ignore.js +0 -13
- package/dist/node_modules/simple-git/src/lib/tasks/check-ignore.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/check-is-repo.js +0 -61
- package/dist/node_modules/simple-git/src/lib/tasks/check-is-repo.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/clean.js +0 -85
- package/dist/node_modules/simple-git/src/lib/tasks/clean.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/clone.js +0 -22
- package/dist/node_modules/simple-git/src/lib/tasks/clone.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/commit.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/tasks/commit.js +0 -16
- package/dist/node_modules/simple-git/src/lib/tasks/commit.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/config.js +0 -73
- package/dist/node_modules/simple-git/src/lib/tasks/config.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/diff.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/tasks/diff.js +0 -15
- package/dist/node_modules/simple-git/src/lib/tasks/diff.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/fetch.js +0 -17
- package/dist/node_modules/simple-git/src/lib/tasks/fetch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/grep.js +0 -76
- package/dist/node_modules/simple-git/src/lib/tasks/grep.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/hash-object.js +0 -16
- package/dist/node_modules/simple-git/src/lib/tasks/hash-object.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/init.js +0 -23
- package/dist/node_modules/simple-git/src/lib/tasks/init.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/log.js +0 -109
- package/dist/node_modules/simple-git/src/lib/tasks/log.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/merge.js +0 -24
- package/dist/node_modules/simple-git/src/lib/tasks/merge.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/move.js +0 -14
- package/dist/node_modules/simple-git/src/lib/tasks/move.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/pull.js +0 -19
- package/dist/node_modules/simple-git/src/lib/tasks/pull.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/push.js +0 -29
- package/dist/node_modules/simple-git/src/lib/tasks/push.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/remote.js +0 -42
- package/dist/node_modules/simple-git/src/lib/tasks/remote.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/reset.js +0 -38
- package/dist/node_modules/simple-git/src/lib/tasks/reset.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/stash-list.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/tasks/stash-list.js +0 -16
- package/dist/node_modules/simple-git/src/lib/tasks/stash-list.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/status.js +0 -15
- package/dist/node_modules/simple-git/src/lib/tasks/status.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/sub-module.js +0 -25
- package/dist/node_modules/simple-git/src/lib/tasks/sub-module.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/tag.js +0 -45
- package/dist/node_modules/simple-git/src/lib/tasks/tag.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/task.js +0 -52
- package/dist/node_modules/simple-git/src/lib/tasks/task.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/types/handlers.js +0 -3
- package/dist/node_modules/simple-git/src/lib/types/handlers.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/types/index.js +0 -15
- package/dist/node_modules/simple-git/src/lib/types/index.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/types/tasks.js +0 -3
- package/dist/node_modules/simple-git/src/lib/types/tasks.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/argument-filters.js +0 -47
- package/dist/node_modules/simple-git/src/lib/utils/argument-filters.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/exit-codes.js +0 -14
- package/dist/node_modules/simple-git/src/lib/utils/exit-codes.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/git-output-streams.js +0 -14
- package/dist/node_modules/simple-git/src/lib/utils/git-output-streams.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/index.js +0 -21
- package/dist/node_modules/simple-git/src/lib/utils/index.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/line-parser.js +0 -52
- package/dist/node_modules/simple-git/src/lib/utils/line-parser.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/simple-git-options.js +0 -16
- package/dist/node_modules/simple-git/src/lib/utils/simple-git-options.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/task-options.js +0 -58
- package/dist/node_modules/simple-git/src/lib/utils/task-options.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/task-parser.js +0 -24
- package/dist/node_modules/simple-git/src/lib/utils/task-parser.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/util.js +0 -146
- package/dist/node_modules/simple-git/src/lib/utils/util.js.map +0 -1
- package/dist/node_modules/simple-git/typings/types.d.ts +0 -14
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/git-construct-error.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/git-response-error.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/task-configuration-error.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/git-logger.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-branch-delete.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-commit.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-fetch.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-merge.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-move.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-push.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-remote-messages.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-remote-objects.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/command-config-prefixing-plugin.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/error-detection.plugin.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/spawn-options-plugin.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/BranchDeleteSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/CheckIgnore.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/CleanSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/ConfigList.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/DiffSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/GetRemoteSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/InitSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/MergeSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/TagList.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/promise-wrapped.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/scheduler.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/tasks-pending-queue.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/simple-git-api.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/task-callback.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/apply-patch.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/branch.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/change-working-directory.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/check-ignore.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/check-is-repo.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/clean.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/grep.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/hash-object.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/init.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/merge.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/move.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/pull.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/push.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/reset.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/status.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/sub-module.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/tag.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/types/handlers.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/types/tasks.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/argument-filters.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/git-output-streams.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/index.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/simple-git-options.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/task-options.d.ts +0 -0
|
@@ -1,39 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol.
|
|
3
|
+
* It can be accessed using:
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* const http2 = require('node:http2');
|
|
7
|
+
* ```
|
|
8
|
+
* @since v8.4.0
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/http2.js)
|
|
10
|
+
*/
|
|
1
11
|
declare module "http2" {
|
|
2
|
-
import EventEmitter = require("events");
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
import * as net from "net";
|
|
5
|
-
import * as stream from "stream";
|
|
6
|
-
import * as tls from "tls";
|
|
7
|
-
import * as url from "url";
|
|
8
|
-
|
|
12
|
+
import EventEmitter = require("node:events");
|
|
13
|
+
import * as fs from "node:fs";
|
|
14
|
+
import * as net from "node:net";
|
|
15
|
+
import * as stream from "node:stream";
|
|
16
|
+
import * as tls from "node:tls";
|
|
17
|
+
import * as url from "node:url";
|
|
9
18
|
import {
|
|
10
19
|
IncomingHttpHeaders as Http1IncomingHttpHeaders,
|
|
11
20
|
IncomingMessage,
|
|
12
21
|
OutgoingHttpHeaders,
|
|
13
22
|
ServerResponse,
|
|
14
|
-
} from "http";
|
|
15
|
-
export { OutgoingHttpHeaders } from "http";
|
|
16
|
-
|
|
23
|
+
} from "node:http";
|
|
24
|
+
export { OutgoingHttpHeaders } from "node:http";
|
|
17
25
|
export interface IncomingHttpStatusHeader {
|
|
18
26
|
":status"?: number | undefined;
|
|
19
27
|
}
|
|
20
|
-
|
|
21
28
|
export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
|
|
22
29
|
":path"?: string | undefined;
|
|
23
30
|
":method"?: string | undefined;
|
|
24
31
|
":authority"?: string | undefined;
|
|
25
32
|
":scheme"?: string | undefined;
|
|
26
33
|
}
|
|
27
|
-
|
|
28
34
|
// Http2Stream
|
|
29
|
-
|
|
30
35
|
export interface StreamPriorityOptions {
|
|
31
36
|
exclusive?: boolean | undefined;
|
|
32
37
|
parent?: number | undefined;
|
|
33
38
|
weight?: number | undefined;
|
|
34
39
|
silent?: boolean | undefined;
|
|
35
40
|
}
|
|
36
|
-
|
|
37
41
|
export interface StreamState {
|
|
38
42
|
localWindowSize?: number | undefined;
|
|
39
43
|
state?: number | undefined;
|
|
@@ -42,52 +46,153 @@ declare module "http2" {
|
|
|
42
46
|
sumDependencyWeight?: number | undefined;
|
|
43
47
|
weight?: number | undefined;
|
|
44
48
|
}
|
|
45
|
-
|
|
46
49
|
export interface ServerStreamResponseOptions {
|
|
47
50
|
endStream?: boolean | undefined;
|
|
48
51
|
waitForTrailers?: boolean | undefined;
|
|
49
52
|
}
|
|
50
|
-
|
|
51
53
|
export interface StatOptions {
|
|
52
54
|
offset: number;
|
|
53
55
|
length: number;
|
|
54
56
|
}
|
|
55
|
-
|
|
56
57
|
export interface ServerStreamFileResponseOptions {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
57
59
|
statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean;
|
|
58
60
|
waitForTrailers?: boolean | undefined;
|
|
59
61
|
offset?: number | undefined;
|
|
60
62
|
length?: number | undefined;
|
|
61
63
|
}
|
|
62
|
-
|
|
63
64
|
export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
|
|
64
65
|
onError?(err: NodeJS.ErrnoException): void;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
67
|
export interface Http2Stream extends stream.Duplex {
|
|
68
|
+
/**
|
|
69
|
+
* Set to `true` if the `Http2Stream` instance was aborted abnormally. When set,
|
|
70
|
+
* the `'aborted'` event will have been emitted.
|
|
71
|
+
* @since v8.4.0
|
|
72
|
+
*/
|
|
68
73
|
readonly aborted: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* This property shows the number of characters currently buffered to be written.
|
|
76
|
+
* See `net.Socket.bufferSize` for details.
|
|
77
|
+
* @since v11.2.0, v10.16.0
|
|
78
|
+
*/
|
|
69
79
|
readonly bufferSize: number;
|
|
80
|
+
/**
|
|
81
|
+
* Set to `true` if the `Http2Stream` instance has been closed.
|
|
82
|
+
* @since v9.4.0
|
|
83
|
+
*/
|
|
70
84
|
readonly closed: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Set to `true` if the `Http2Stream` instance has been destroyed and is no longer
|
|
87
|
+
* usable.
|
|
88
|
+
* @since v8.4.0
|
|
89
|
+
*/
|
|
71
90
|
readonly destroyed: boolean;
|
|
72
91
|
/**
|
|
73
|
-
* Set
|
|
74
|
-
* indicating that no additional data should be received
|
|
92
|
+
* Set to `true` if the `END_STREAM` flag was set in the request or response
|
|
93
|
+
* HEADERS frame received, indicating that no additional data should be received
|
|
94
|
+
* and the readable side of the `Http2Stream` will be closed.
|
|
95
|
+
* @since v10.11.0
|
|
75
96
|
*/
|
|
76
97
|
readonly endAfterHeaders: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned.
|
|
100
|
+
* @since v8.4.0
|
|
101
|
+
*/
|
|
77
102
|
readonly id?: number | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Set to `true` if the `Http2Stream` instance has not yet been assigned a
|
|
105
|
+
* numeric stream identifier.
|
|
106
|
+
* @since v9.4.0
|
|
107
|
+
*/
|
|
78
108
|
readonly pending: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is
|
|
111
|
+
* destroyed after either receiving an `RST_STREAM` frame from the connected peer,
|
|
112
|
+
* calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed.
|
|
113
|
+
* @since v8.4.0
|
|
114
|
+
*/
|
|
79
115
|
readonly rstCode: number;
|
|
116
|
+
/**
|
|
117
|
+
* An object containing the outbound headers sent for this `Http2Stream`.
|
|
118
|
+
* @since v9.5.0
|
|
119
|
+
*/
|
|
80
120
|
readonly sentHeaders: OutgoingHttpHeaders;
|
|
121
|
+
/**
|
|
122
|
+
* An array of objects containing the outbound informational (additional) headers
|
|
123
|
+
* sent for this `Http2Stream`.
|
|
124
|
+
* @since v9.5.0
|
|
125
|
+
*/
|
|
81
126
|
readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* An object containing the outbound trailers sent for this `HttpStream`.
|
|
129
|
+
* @since v9.5.0
|
|
130
|
+
*/
|
|
82
131
|
readonly sentTrailers?: OutgoingHttpHeaders | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* A reference to the `Http2Session` instance that owns this `Http2Stream`. The
|
|
134
|
+
* value will be `undefined` after the `Http2Stream` instance is destroyed.
|
|
135
|
+
* @since v8.4.0
|
|
136
|
+
*/
|
|
83
137
|
readonly session: Http2Session | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Provides miscellaneous information about the current state of the `Http2Stream`.
|
|
140
|
+
*
|
|
141
|
+
* A current state of this `Http2Stream`.
|
|
142
|
+
* @since v8.4.0
|
|
143
|
+
*/
|
|
84
144
|
readonly state: StreamState;
|
|
85
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the
|
|
147
|
+
* connected HTTP/2 peer.
|
|
148
|
+
* @since v8.4.0
|
|
149
|
+
* @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code.
|
|
150
|
+
* @param callback An optional function registered to listen for the `'close'` event.
|
|
151
|
+
*/
|
|
86
152
|
close(code?: number, callback?: () => void): void;
|
|
153
|
+
/**
|
|
154
|
+
* Updates the priority for this `Http2Stream` instance.
|
|
155
|
+
* @since v8.4.0
|
|
156
|
+
*/
|
|
87
157
|
priority(options: StreamPriorityOptions): void;
|
|
158
|
+
/**
|
|
159
|
+
* ```js
|
|
160
|
+
* const http2 = require('node:http2');
|
|
161
|
+
* const client = http2.connect('http://example.org:8000');
|
|
162
|
+
* const { NGHTTP2_CANCEL } = http2.constants;
|
|
163
|
+
* const req = client.request({ ':path': '/' });
|
|
164
|
+
*
|
|
165
|
+
* // Cancel the stream if there's no activity after 5 seconds
|
|
166
|
+
* req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL));
|
|
167
|
+
* ```
|
|
168
|
+
* @since v8.4.0
|
|
169
|
+
*/
|
|
88
170
|
setTimeout(msecs: number, callback?: () => void): void;
|
|
171
|
+
/**
|
|
172
|
+
* Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method
|
|
173
|
+
* will cause the `Http2Stream` to be immediately closed and must only be
|
|
174
|
+
* called after the `'wantTrailers'` event has been emitted. When sending a
|
|
175
|
+
* request or sending a response, the `options.waitForTrailers` option must be set
|
|
176
|
+
* in order to keep the `Http2Stream` open after the final `DATA` frame so that
|
|
177
|
+
* trailers can be sent.
|
|
178
|
+
*
|
|
179
|
+
* ```js
|
|
180
|
+
* const http2 = require('node:http2');
|
|
181
|
+
* const server = http2.createServer();
|
|
182
|
+
* server.on('stream', (stream) => {
|
|
183
|
+
* stream.respond(undefined, { waitForTrailers: true });
|
|
184
|
+
* stream.on('wantTrailers', () => {
|
|
185
|
+
* stream.sendTrailers({ xyz: 'abc' });
|
|
186
|
+
* });
|
|
187
|
+
* stream.end('Hello World');
|
|
188
|
+
* });
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header
|
|
192
|
+
* fields (e.g. `':method'`, `':path'`, etc).
|
|
193
|
+
* @since v10.0.0
|
|
194
|
+
*/
|
|
89
195
|
sendTrailers(headers: OutgoingHttpHeaders): void;
|
|
90
|
-
|
|
91
196
|
addListener(event: "aborted", listener: () => void): this;
|
|
92
197
|
addListener(event: "close", listener: () => void): this;
|
|
93
198
|
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -103,7 +208,6 @@ declare module "http2" {
|
|
|
103
208
|
addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
|
104
209
|
addListener(event: "wantTrailers", listener: () => void): this;
|
|
105
210
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
106
|
-
|
|
107
211
|
emit(event: "aborted"): boolean;
|
|
108
212
|
emit(event: "close"): boolean;
|
|
109
213
|
emit(event: "data", chunk: Buffer | string): boolean;
|
|
@@ -119,7 +223,6 @@ declare module "http2" {
|
|
|
119
223
|
emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean;
|
|
120
224
|
emit(event: "wantTrailers"): boolean;
|
|
121
225
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
122
|
-
|
|
123
226
|
on(event: "aborted", listener: () => void): this;
|
|
124
227
|
on(event: "close", listener: () => void): this;
|
|
125
228
|
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -135,7 +238,6 @@ declare module "http2" {
|
|
|
135
238
|
on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
|
136
239
|
on(event: "wantTrailers", listener: () => void): this;
|
|
137
240
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
138
|
-
|
|
139
241
|
once(event: "aborted", listener: () => void): this;
|
|
140
242
|
once(event: "close", listener: () => void): this;
|
|
141
243
|
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -151,7 +253,6 @@ declare module "http2" {
|
|
|
151
253
|
once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
|
152
254
|
once(event: "wantTrailers", listener: () => void): this;
|
|
153
255
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
154
|
-
|
|
155
256
|
prependListener(event: "aborted", listener: () => void): this;
|
|
156
257
|
prependListener(event: "close", listener: () => void): this;
|
|
157
258
|
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -167,7 +268,6 @@ declare module "http2" {
|
|
|
167
268
|
prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
|
168
269
|
prependListener(event: "wantTrailers", listener: () => void): this;
|
|
169
270
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
170
|
-
|
|
171
271
|
prependOnceListener(event: "aborted", listener: () => void): this;
|
|
172
272
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
173
273
|
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -184,7 +284,6 @@ declare module "http2" {
|
|
|
184
284
|
prependOnceListener(event: "wantTrailers", listener: () => void): this;
|
|
185
285
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
186
286
|
}
|
|
187
|
-
|
|
188
287
|
export interface ClientHttp2Stream extends Http2Stream {
|
|
189
288
|
addListener(event: "continue", listener: () => {}): this;
|
|
190
289
|
addListener(
|
|
@@ -197,13 +296,11 @@ declare module "http2" {
|
|
|
197
296
|
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
|
198
297
|
): this;
|
|
199
298
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
200
|
-
|
|
201
299
|
emit(event: "continue"): boolean;
|
|
202
300
|
emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
|
203
301
|
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
|
|
204
302
|
emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
|
205
303
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
206
|
-
|
|
207
304
|
on(event: "continue", listener: () => {}): this;
|
|
208
305
|
on(
|
|
209
306
|
event: "headers",
|
|
@@ -215,7 +312,6 @@ declare module "http2" {
|
|
|
215
312
|
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
|
216
313
|
): this;
|
|
217
314
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
218
|
-
|
|
219
315
|
once(event: "continue", listener: () => {}): this;
|
|
220
316
|
once(
|
|
221
317
|
event: "headers",
|
|
@@ -227,7 +323,6 @@ declare module "http2" {
|
|
|
227
323
|
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
|
228
324
|
): this;
|
|
229
325
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
230
|
-
|
|
231
326
|
prependListener(event: "continue", listener: () => {}): this;
|
|
232
327
|
prependListener(
|
|
233
328
|
event: "headers",
|
|
@@ -239,7 +334,6 @@ declare module "http2" {
|
|
|
239
334
|
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
|
240
335
|
): this;
|
|
241
336
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
242
|
-
|
|
243
337
|
prependOnceListener(event: "continue", listener: () => {}): this;
|
|
244
338
|
prependOnceListener(
|
|
245
339
|
event: "headers",
|
|
@@ -252,11 +346,49 @@ declare module "http2" {
|
|
|
252
346
|
): this;
|
|
253
347
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
254
348
|
}
|
|
255
|
-
|
|
256
349
|
export interface ServerHttp2Stream extends Http2Stream {
|
|
350
|
+
/**
|
|
351
|
+
* True if headers were sent, false otherwise (read-only).
|
|
352
|
+
* @since v8.4.0
|
|
353
|
+
*/
|
|
257
354
|
readonly headersSent: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote
|
|
357
|
+
* client's most recent `SETTINGS` frame. Will be `true` if the remote peer
|
|
358
|
+
* accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`.
|
|
359
|
+
* @since v8.4.0
|
|
360
|
+
*/
|
|
258
361
|
readonly pushAllowed: boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer.
|
|
364
|
+
* @since v8.4.0
|
|
365
|
+
*/
|
|
259
366
|
additionalHeaders(headers: OutgoingHttpHeaders): void;
|
|
367
|
+
/**
|
|
368
|
+
* Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument.
|
|
369
|
+
*
|
|
370
|
+
* ```js
|
|
371
|
+
* const http2 = require('node:http2');
|
|
372
|
+
* const server = http2.createServer();
|
|
373
|
+
* server.on('stream', (stream) => {
|
|
374
|
+
* stream.respond({ ':status': 200 });
|
|
375
|
+
* stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => {
|
|
376
|
+
* if (err) throw err;
|
|
377
|
+
* pushStream.respond({ ':status': 200 });
|
|
378
|
+
* pushStream.end('some pushed data');
|
|
379
|
+
* });
|
|
380
|
+
* stream.end('some data');
|
|
381
|
+
* });
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass
|
|
385
|
+
* a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams.
|
|
386
|
+
*
|
|
387
|
+
* Calling `http2stream.pushStream()` from within a pushed stream is not permitted
|
|
388
|
+
* and will throw an error.
|
|
389
|
+
* @since v8.4.0
|
|
390
|
+
* @param callback Callback that is called once the push stream has been initiated.
|
|
391
|
+
*/
|
|
260
392
|
pushStream(
|
|
261
393
|
headers: OutgoingHttpHeaders,
|
|
262
394
|
callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
|
|
@@ -266,21 +398,223 @@ declare module "http2" {
|
|
|
266
398
|
options?: StreamPriorityOptions,
|
|
267
399
|
callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
|
|
268
400
|
): void;
|
|
401
|
+
/**
|
|
402
|
+
* ```js
|
|
403
|
+
* const http2 = require('node:http2');
|
|
404
|
+
* const server = http2.createServer();
|
|
405
|
+
* server.on('stream', (stream) => {
|
|
406
|
+
* stream.respond({ ':status': 200 });
|
|
407
|
+
* stream.end('some data');
|
|
408
|
+
* });
|
|
409
|
+
* ```
|
|
410
|
+
*
|
|
411
|
+
* Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk
|
|
412
|
+
* of payload data to be sent. The `http2stream.sendTrailers()` method can then be
|
|
413
|
+
* used to sent trailing header fields to the peer.
|
|
414
|
+
*
|
|
415
|
+
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
416
|
+
* close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
|
417
|
+
*
|
|
418
|
+
* ```js
|
|
419
|
+
* const http2 = require('node:http2');
|
|
420
|
+
* const server = http2.createServer();
|
|
421
|
+
* server.on('stream', (stream) => {
|
|
422
|
+
* stream.respond({ ':status': 200 }, { waitForTrailers: true });
|
|
423
|
+
* stream.on('wantTrailers', () => {
|
|
424
|
+
* stream.sendTrailers({ ABC: 'some value to send' });
|
|
425
|
+
* });
|
|
426
|
+
* stream.end('some data');
|
|
427
|
+
* });
|
|
428
|
+
* ```
|
|
429
|
+
* @since v8.4.0
|
|
430
|
+
*/
|
|
269
431
|
respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void;
|
|
432
|
+
/**
|
|
433
|
+
* Initiates a response whose data is read from the given file descriptor. No
|
|
434
|
+
* validation is performed on the given file descriptor. If an error occurs while
|
|
435
|
+
* attempting to read data using the file descriptor, the `Http2Stream` will be
|
|
436
|
+
* closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code.
|
|
437
|
+
*
|
|
438
|
+
* When used, the `Http2Stream` object's `Duplex` interface will be closed
|
|
439
|
+
* automatically.
|
|
440
|
+
*
|
|
441
|
+
* ```js
|
|
442
|
+
* const http2 = require('node:http2');
|
|
443
|
+
* const fs = require('node:fs');
|
|
444
|
+
*
|
|
445
|
+
* const server = http2.createServer();
|
|
446
|
+
* server.on('stream', (stream) => {
|
|
447
|
+
* const fd = fs.openSync('/some/file', 'r');
|
|
448
|
+
*
|
|
449
|
+
* const stat = fs.fstatSync(fd);
|
|
450
|
+
* const headers = {
|
|
451
|
+
* 'content-length': stat.size,
|
|
452
|
+
* 'last-modified': stat.mtime.toUTCString(),
|
|
453
|
+
* 'content-type': 'text/plain; charset=utf-8',
|
|
454
|
+
* };
|
|
455
|
+
* stream.respondWithFD(fd, headers);
|
|
456
|
+
* stream.on('close', () => fs.closeSync(fd));
|
|
457
|
+
* });
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* The optional `options.statCheck` function may be specified to give user code
|
|
461
|
+
* an opportunity to set additional content headers based on the `fs.Stat` details
|
|
462
|
+
* of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will perform an `fs.fstat()` call to
|
|
463
|
+
* collect details on the provided file descriptor.
|
|
464
|
+
*
|
|
465
|
+
* The `offset` and `length` options may be used to limit the response to a
|
|
466
|
+
* specific range subset. This can be used, for instance, to support HTTP Range
|
|
467
|
+
* requests.
|
|
468
|
+
*
|
|
469
|
+
* The file descriptor or `FileHandle` is not closed when the stream is closed,
|
|
470
|
+
* so it will need to be closed manually once it is no longer needed.
|
|
471
|
+
* Using the same file descriptor concurrently for multiple streams
|
|
472
|
+
* is not supported and may result in data loss. Re-using a file descriptor
|
|
473
|
+
* after a stream has finished is supported.
|
|
474
|
+
*
|
|
475
|
+
* When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
|
|
476
|
+
* will be emitted immediately after queuing the last chunk of payload data to be
|
|
477
|
+
* sent. The `http2stream.sendTrailers()` method can then be used to sent trailing
|
|
478
|
+
* header fields to the peer.
|
|
479
|
+
*
|
|
480
|
+
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
481
|
+
* close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
|
482
|
+
*
|
|
483
|
+
* ```js
|
|
484
|
+
* const http2 = require('node:http2');
|
|
485
|
+
* const fs = require('node:fs');
|
|
486
|
+
*
|
|
487
|
+
* const server = http2.createServer();
|
|
488
|
+
* server.on('stream', (stream) => {
|
|
489
|
+
* const fd = fs.openSync('/some/file', 'r');
|
|
490
|
+
*
|
|
491
|
+
* const stat = fs.fstatSync(fd);
|
|
492
|
+
* const headers = {
|
|
493
|
+
* 'content-length': stat.size,
|
|
494
|
+
* 'last-modified': stat.mtime.toUTCString(),
|
|
495
|
+
* 'content-type': 'text/plain; charset=utf-8',
|
|
496
|
+
* };
|
|
497
|
+
* stream.respondWithFD(fd, headers, { waitForTrailers: true });
|
|
498
|
+
* stream.on('wantTrailers', () => {
|
|
499
|
+
* stream.sendTrailers({ ABC: 'some value to send' });
|
|
500
|
+
* });
|
|
501
|
+
*
|
|
502
|
+
* stream.on('close', () => fs.closeSync(fd));
|
|
503
|
+
* });
|
|
504
|
+
* ```
|
|
505
|
+
* @since v8.4.0
|
|
506
|
+
* @param fd A readable file descriptor.
|
|
507
|
+
*/
|
|
270
508
|
respondWithFD(
|
|
271
509
|
fd: number | fs.promises.FileHandle,
|
|
272
510
|
headers?: OutgoingHttpHeaders,
|
|
273
511
|
options?: ServerStreamFileResponseOptions,
|
|
274
512
|
): void;
|
|
513
|
+
/**
|
|
514
|
+
* Sends a regular file as the response. The `path` must specify a regular file
|
|
515
|
+
* or an `'error'` event will be emitted on the `Http2Stream` object.
|
|
516
|
+
*
|
|
517
|
+
* When used, the `Http2Stream` object's `Duplex` interface will be closed
|
|
518
|
+
* automatically.
|
|
519
|
+
*
|
|
520
|
+
* The optional `options.statCheck` function may be specified to give user code
|
|
521
|
+
* an opportunity to set additional content headers based on the `fs.Stat` details
|
|
522
|
+
* of the given file:
|
|
523
|
+
*
|
|
524
|
+
* If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. If the `onError` callback is
|
|
525
|
+
* defined, then it will be called. Otherwise
|
|
526
|
+
* the stream will be destroyed.
|
|
527
|
+
*
|
|
528
|
+
* Example using a file path:
|
|
529
|
+
*
|
|
530
|
+
* ```js
|
|
531
|
+
* const http2 = require('node:http2');
|
|
532
|
+
* const server = http2.createServer();
|
|
533
|
+
* server.on('stream', (stream) => {
|
|
534
|
+
* function statCheck(stat, headers) {
|
|
535
|
+
* headers['last-modified'] = stat.mtime.toUTCString();
|
|
536
|
+
* }
|
|
537
|
+
*
|
|
538
|
+
* function onError(err) {
|
|
539
|
+
* // stream.respond() can throw if the stream has been destroyed by
|
|
540
|
+
* // the other side.
|
|
541
|
+
* try {
|
|
542
|
+
* if (err.code === 'ENOENT') {
|
|
543
|
+
* stream.respond({ ':status': 404 });
|
|
544
|
+
* } else {
|
|
545
|
+
* stream.respond({ ':status': 500 });
|
|
546
|
+
* }
|
|
547
|
+
* } catch (err) {
|
|
548
|
+
* // Perform actual error handling.
|
|
549
|
+
* console.error(err);
|
|
550
|
+
* }
|
|
551
|
+
* stream.end();
|
|
552
|
+
* }
|
|
553
|
+
*
|
|
554
|
+
* stream.respondWithFile('/some/file',
|
|
555
|
+
* { 'content-type': 'text/plain; charset=utf-8' },
|
|
556
|
+
* { statCheck, onError });
|
|
557
|
+
* });
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
* The `options.statCheck` function may also be used to cancel the send operation
|
|
561
|
+
* by returning `false`. For instance, a conditional request may check the stat
|
|
562
|
+
* results to determine if the file has been modified to return an appropriate `304` response:
|
|
563
|
+
*
|
|
564
|
+
* ```js
|
|
565
|
+
* const http2 = require('node:http2');
|
|
566
|
+
* const server = http2.createServer();
|
|
567
|
+
* server.on('stream', (stream) => {
|
|
568
|
+
* function statCheck(stat, headers) {
|
|
569
|
+
* // Check the stat here...
|
|
570
|
+
* stream.respond({ ':status': 304 });
|
|
571
|
+
* return false; // Cancel the send operation
|
|
572
|
+
* }
|
|
573
|
+
* stream.respondWithFile('/some/file',
|
|
574
|
+
* { 'content-type': 'text/plain; charset=utf-8' },
|
|
575
|
+
* { statCheck });
|
|
576
|
+
* });
|
|
577
|
+
* ```
|
|
578
|
+
*
|
|
579
|
+
* The `content-length` header field will be automatically set.
|
|
580
|
+
*
|
|
581
|
+
* The `offset` and `length` options may be used to limit the response to a
|
|
582
|
+
* specific range subset. This can be used, for instance, to support HTTP Range
|
|
583
|
+
* requests.
|
|
584
|
+
*
|
|
585
|
+
* The `options.onError` function may also be used to handle all the errors
|
|
586
|
+
* that could happen before the delivery of the file is initiated. The
|
|
587
|
+
* default behavior is to destroy the stream.
|
|
588
|
+
*
|
|
589
|
+
* When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
|
|
590
|
+
* will be emitted immediately after queuing the last chunk of payload data to be
|
|
591
|
+
* sent. The `http2stream.sendTrailers()` method can then be used to sent trailing
|
|
592
|
+
* header fields to the peer.
|
|
593
|
+
*
|
|
594
|
+
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
595
|
+
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
|
596
|
+
*
|
|
597
|
+
* ```js
|
|
598
|
+
* const http2 = require('node:http2');
|
|
599
|
+
* const server = http2.createServer();
|
|
600
|
+
* server.on('stream', (stream) => {
|
|
601
|
+
* stream.respondWithFile('/some/file',
|
|
602
|
+
* { 'content-type': 'text/plain; charset=utf-8' },
|
|
603
|
+
* { waitForTrailers: true });
|
|
604
|
+
* stream.on('wantTrailers', () => {
|
|
605
|
+
* stream.sendTrailers({ ABC: 'some value to send' });
|
|
606
|
+
* });
|
|
607
|
+
* });
|
|
608
|
+
* ```
|
|
609
|
+
* @since v8.4.0
|
|
610
|
+
*/
|
|
275
611
|
respondWithFile(
|
|
276
612
|
path: string,
|
|
277
613
|
headers?: OutgoingHttpHeaders,
|
|
278
614
|
options?: ServerStreamFileResponseOptionsWithError,
|
|
279
615
|
): void;
|
|
280
616
|
}
|
|
281
|
-
|
|
282
617
|
// Http2Session
|
|
283
|
-
|
|
284
618
|
export interface Settings {
|
|
285
619
|
headerTableSize?: number | undefined;
|
|
286
620
|
enablePush?: boolean | undefined;
|
|
@@ -290,7 +624,6 @@ declare module "http2" {
|
|
|
290
624
|
maxHeaderListSize?: number | undefined;
|
|
291
625
|
enableConnectProtocol?: boolean | undefined;
|
|
292
626
|
}
|
|
293
|
-
|
|
294
627
|
export interface ClientSessionRequestOptions {
|
|
295
628
|
endStream?: boolean | undefined;
|
|
296
629
|
exclusive?: boolean | undefined;
|
|
@@ -299,7 +632,6 @@ declare module "http2" {
|
|
|
299
632
|
waitForTrailers?: boolean | undefined;
|
|
300
633
|
signal?: AbortSignal | undefined;
|
|
301
634
|
}
|
|
302
|
-
|
|
303
635
|
export interface SessionState {
|
|
304
636
|
effectiveLocalWindowSize?: number | undefined;
|
|
305
637
|
effectiveRecvDataLength?: number | undefined;
|
|
@@ -311,38 +643,205 @@ declare module "http2" {
|
|
|
311
643
|
deflateDynamicTableSize?: number | undefined;
|
|
312
644
|
inflateDynamicTableSize?: number | undefined;
|
|
313
645
|
}
|
|
314
|
-
|
|
315
646
|
export interface Http2Session extends EventEmitter {
|
|
647
|
+
/**
|
|
648
|
+
* Value will be `undefined` if the `Http2Session` is not yet connected to a
|
|
649
|
+
* socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or
|
|
650
|
+
* will return the value of the connected `TLSSocket`'s own `alpnProtocol` property.
|
|
651
|
+
* @since v9.4.0
|
|
652
|
+
*/
|
|
316
653
|
readonly alpnProtocol?: string | undefined;
|
|
654
|
+
/**
|
|
655
|
+
* Will be `true` if this `Http2Session` instance has been closed, otherwise `false`.
|
|
656
|
+
* @since v9.4.0
|
|
657
|
+
*/
|
|
317
658
|
readonly closed: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* Will be `true` if this `Http2Session` instance is still connecting, will be set
|
|
661
|
+
* to `false` before emitting `connect` event and/or calling the `http2.connect` callback.
|
|
662
|
+
* @since v10.0.0
|
|
663
|
+
*/
|
|
318
664
|
readonly connecting: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Will be `true` if this `Http2Session` instance has been destroyed and must no
|
|
667
|
+
* longer be used, otherwise `false`.
|
|
668
|
+
* @since v8.4.0
|
|
669
|
+
*/
|
|
319
670
|
readonly destroyed: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* Value is `undefined` if the `Http2Session` session socket has not yet been
|
|
673
|
+
* connected, `true` if the `Http2Session` is connected with a `TLSSocket`,
|
|
674
|
+
* and `false` if the `Http2Session` is connected to any other kind of socket
|
|
675
|
+
* or stream.
|
|
676
|
+
* @since v9.4.0
|
|
677
|
+
*/
|
|
320
678
|
readonly encrypted?: boolean | undefined;
|
|
679
|
+
/**
|
|
680
|
+
* A prototype-less object describing the current local settings of this `Http2Session`. The local settings are local to _this_`Http2Session` instance.
|
|
681
|
+
* @since v8.4.0
|
|
682
|
+
*/
|
|
321
683
|
readonly localSettings: Settings;
|
|
684
|
+
/**
|
|
685
|
+
* If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property
|
|
686
|
+
* will return an `Array` of origins for which the `Http2Session` may be
|
|
687
|
+
* considered authoritative.
|
|
688
|
+
*
|
|
689
|
+
* The `originSet` property is only available when using a secure TLS connection.
|
|
690
|
+
* @since v9.4.0
|
|
691
|
+
*/
|
|
322
692
|
readonly originSet?: string[] | undefined;
|
|
693
|
+
/**
|
|
694
|
+
* Indicates whether the `Http2Session` is currently waiting for acknowledgment of
|
|
695
|
+
* a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. Will be `false` once all sent `SETTINGS` frames have been acknowledged.
|
|
696
|
+
* @since v8.4.0
|
|
697
|
+
*/
|
|
323
698
|
readonly pendingSettingsAck: boolean;
|
|
699
|
+
/**
|
|
700
|
+
* A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer.
|
|
701
|
+
* @since v8.4.0
|
|
702
|
+
*/
|
|
324
703
|
readonly remoteSettings: Settings;
|
|
704
|
+
/**
|
|
705
|
+
* Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
|
|
706
|
+
* limits available methods to ones safe to use with HTTP/2.
|
|
707
|
+
*
|
|
708
|
+
* `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw
|
|
709
|
+
* an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information.
|
|
710
|
+
*
|
|
711
|
+
* `setTimeout` method will be called on this `Http2Session`.
|
|
712
|
+
*
|
|
713
|
+
* All other interactions will be routed directly to the socket.
|
|
714
|
+
* @since v8.4.0
|
|
715
|
+
*/
|
|
325
716
|
readonly socket: net.Socket | tls.TLSSocket;
|
|
717
|
+
/**
|
|
718
|
+
* Provides miscellaneous information about the current state of the`Http2Session`.
|
|
719
|
+
*
|
|
720
|
+
* An object describing the current status of this `Http2Session`.
|
|
721
|
+
* @since v8.4.0
|
|
722
|
+
*/
|
|
326
723
|
readonly state: SessionState;
|
|
724
|
+
/**
|
|
725
|
+
* The `http2session.type` will be equal to `http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a
|
|
726
|
+
* server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a
|
|
727
|
+
* client.
|
|
728
|
+
* @since v8.4.0
|
|
729
|
+
*/
|
|
327
730
|
readonly type: number;
|
|
328
|
-
|
|
731
|
+
/**
|
|
732
|
+
* Gracefully closes the `Http2Session`, allowing any existing streams to
|
|
733
|
+
* complete on their own and preventing new `Http2Stream` instances from being
|
|
734
|
+
* created. Once closed, `http2session.destroy()`_might_ be called if there
|
|
735
|
+
* are no open `Http2Stream` instances.
|
|
736
|
+
*
|
|
737
|
+
* If specified, the `callback` function is registered as a handler for the`'close'` event.
|
|
738
|
+
* @since v9.4.0
|
|
739
|
+
*/
|
|
329
740
|
close(callback?: () => void): void;
|
|
741
|
+
/**
|
|
742
|
+
* Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`.
|
|
743
|
+
*
|
|
744
|
+
* Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` is not undefined, an `'error'` event will be emitted immediately before the `'close'` event.
|
|
745
|
+
*
|
|
746
|
+
* If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed.
|
|
747
|
+
* @since v8.4.0
|
|
748
|
+
* @param error An `Error` object if the `Http2Session` is being destroyed due to an error.
|
|
749
|
+
* @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`.
|
|
750
|
+
*/
|
|
330
751
|
destroy(error?: Error, code?: number): void;
|
|
752
|
+
/**
|
|
753
|
+
* Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`.
|
|
754
|
+
* @since v9.4.0
|
|
755
|
+
* @param code An HTTP/2 error code
|
|
756
|
+
* @param lastStreamID The numeric ID of the last processed `Http2Stream`
|
|
757
|
+
* @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame.
|
|
758
|
+
*/
|
|
331
759
|
goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void;
|
|
760
|
+
/**
|
|
761
|
+
* Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must
|
|
762
|
+
* be provided. The method will return `true` if the `PING` was sent, `false` otherwise.
|
|
763
|
+
*
|
|
764
|
+
* The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10.
|
|
765
|
+
*
|
|
766
|
+
* If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and
|
|
767
|
+
* returned with the ping acknowledgment.
|
|
768
|
+
*
|
|
769
|
+
* The callback will be invoked with three arguments: an error argument that will
|
|
770
|
+
* be `null` if the `PING` was successfully acknowledged, a `duration` argument
|
|
771
|
+
* that reports the number of milliseconds elapsed since the ping was sent and the
|
|
772
|
+
* acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload.
|
|
773
|
+
*
|
|
774
|
+
* ```js
|
|
775
|
+
* session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => {
|
|
776
|
+
* if (!err) {
|
|
777
|
+
* console.log(`Ping acknowledged in ${duration} milliseconds`);
|
|
778
|
+
* console.log(`With payload '${payload.toString()}'`);
|
|
779
|
+
* }
|
|
780
|
+
* });
|
|
781
|
+
* ```
|
|
782
|
+
*
|
|
783
|
+
* If the `payload` argument is not specified, the default payload will be the
|
|
784
|
+
* 64-bit timestamp (little endian) marking the start of the `PING` duration.
|
|
785
|
+
* @since v8.9.3
|
|
786
|
+
* @param payload Optional ping payload.
|
|
787
|
+
*/
|
|
332
788
|
ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
|
|
333
789
|
ping(
|
|
334
790
|
payload: NodeJS.ArrayBufferView,
|
|
335
791
|
callback: (err: Error | null, duration: number, payload: Buffer) => void,
|
|
336
792
|
): boolean;
|
|
793
|
+
/**
|
|
794
|
+
* Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`.
|
|
795
|
+
* @since v9.4.0
|
|
796
|
+
*/
|
|
337
797
|
ref(): void;
|
|
798
|
+
/**
|
|
799
|
+
* Sets the local endpoint's window size.
|
|
800
|
+
* The `windowSize` is the total window size to set, not
|
|
801
|
+
* the delta.
|
|
802
|
+
*
|
|
803
|
+
* ```js
|
|
804
|
+
* const http2 = require('node:http2');
|
|
805
|
+
*
|
|
806
|
+
* const server = http2.createServer();
|
|
807
|
+
* const expectedWindowSize = 2 ** 20;
|
|
808
|
+
* server.on('connect', (session) => {
|
|
809
|
+
*
|
|
810
|
+
* // Set local window size to be 2 ** 20
|
|
811
|
+
* session.setLocalWindowSize(expectedWindowSize);
|
|
812
|
+
* });
|
|
813
|
+
* ```
|
|
814
|
+
* @since v15.3.0, v14.18.0
|
|
815
|
+
*/
|
|
338
816
|
setLocalWindowSize(windowSize: number): void;
|
|
817
|
+
/**
|
|
818
|
+
* Used to set a callback function that is called when there is no activity on
|
|
819
|
+
* the `Http2Session` after `msecs` milliseconds. The given `callback` is
|
|
820
|
+
* registered as a listener on the `'timeout'` event.
|
|
821
|
+
* @since v8.4.0
|
|
822
|
+
*/
|
|
339
823
|
setTimeout(msecs: number, callback?: () => void): void;
|
|
824
|
+
/**
|
|
825
|
+
* Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer.
|
|
826
|
+
*
|
|
827
|
+
* Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new
|
|
828
|
+
* settings.
|
|
829
|
+
*
|
|
830
|
+
* The new settings will not become effective until the `SETTINGS` acknowledgment
|
|
831
|
+
* is received and the `'localSettings'` event is emitted. It is possible to send
|
|
832
|
+
* multiple `SETTINGS` frames while acknowledgment is still pending.
|
|
833
|
+
* @since v8.4.0
|
|
834
|
+
* @param callback Callback that is called once the session is connected or right away if the session is already connected.
|
|
835
|
+
*/
|
|
340
836
|
settings(
|
|
341
837
|
settings: Settings,
|
|
342
838
|
callback?: (err: Error | null, settings: Settings, duration: number) => void,
|
|
343
839
|
): void;
|
|
840
|
+
/**
|
|
841
|
+
* Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`.
|
|
842
|
+
* @since v9.4.0
|
|
843
|
+
*/
|
|
344
844
|
unref(): void;
|
|
345
|
-
|
|
346
845
|
addListener(event: "close", listener: () => void): this;
|
|
347
846
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
348
847
|
addListener(
|
|
@@ -351,44 +850,40 @@ declare module "http2" {
|
|
|
351
850
|
): this;
|
|
352
851
|
addListener(
|
|
353
852
|
event: "goaway",
|
|
354
|
-
listener: (errorCode: number, lastStreamID: number, opaqueData
|
|
853
|
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void,
|
|
355
854
|
): this;
|
|
356
855
|
addListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
|
357
856
|
addListener(event: "ping", listener: () => void): this;
|
|
358
857
|
addListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
|
359
858
|
addListener(event: "timeout", listener: () => void): this;
|
|
360
859
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
361
|
-
|
|
362
860
|
emit(event: "close"): boolean;
|
|
363
861
|
emit(event: "error", err: Error): boolean;
|
|
364
862
|
emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
|
|
365
|
-
emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData
|
|
863
|
+
emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: Buffer): boolean;
|
|
366
864
|
emit(event: "localSettings", settings: Settings): boolean;
|
|
367
865
|
emit(event: "ping"): boolean;
|
|
368
866
|
emit(event: "remoteSettings", settings: Settings): boolean;
|
|
369
867
|
emit(event: "timeout"): boolean;
|
|
370
868
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
371
|
-
|
|
372
869
|
on(event: "close", listener: () => void): this;
|
|
373
870
|
on(event: "error", listener: (err: Error) => void): this;
|
|
374
871
|
on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
|
375
|
-
on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData
|
|
872
|
+
on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this;
|
|
376
873
|
on(event: "localSettings", listener: (settings: Settings) => void): this;
|
|
377
874
|
on(event: "ping", listener: () => void): this;
|
|
378
875
|
on(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
|
379
876
|
on(event: "timeout", listener: () => void): this;
|
|
380
877
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
381
|
-
|
|
382
878
|
once(event: "close", listener: () => void): this;
|
|
383
879
|
once(event: "error", listener: (err: Error) => void): this;
|
|
384
880
|
once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
|
385
|
-
once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData
|
|
881
|
+
once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this;
|
|
386
882
|
once(event: "localSettings", listener: (settings: Settings) => void): this;
|
|
387
883
|
once(event: "ping", listener: () => void): this;
|
|
388
884
|
once(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
|
389
885
|
once(event: "timeout", listener: () => void): this;
|
|
390
886
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
391
|
-
|
|
392
887
|
prependListener(event: "close", listener: () => void): this;
|
|
393
888
|
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
394
889
|
prependListener(
|
|
@@ -397,14 +892,13 @@ declare module "http2" {
|
|
|
397
892
|
): this;
|
|
398
893
|
prependListener(
|
|
399
894
|
event: "goaway",
|
|
400
|
-
listener: (errorCode: number, lastStreamID: number, opaqueData
|
|
895
|
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void,
|
|
401
896
|
): this;
|
|
402
897
|
prependListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
|
403
898
|
prependListener(event: "ping", listener: () => void): this;
|
|
404
899
|
prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
|
405
900
|
prependListener(event: "timeout", listener: () => void): this;
|
|
406
901
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
407
|
-
|
|
408
902
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
409
903
|
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
410
904
|
prependOnceListener(
|
|
@@ -413,7 +907,7 @@ declare module "http2" {
|
|
|
413
907
|
): this;
|
|
414
908
|
prependOnceListener(
|
|
415
909
|
event: "goaway",
|
|
416
|
-
listener: (errorCode: number, lastStreamID: number, opaqueData
|
|
910
|
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void,
|
|
417
911
|
): this;
|
|
418
912
|
prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
|
419
913
|
prependOnceListener(event: "ping", listener: () => void): this;
|
|
@@ -421,10 +915,53 @@ declare module "http2" {
|
|
|
421
915
|
prependOnceListener(event: "timeout", listener: () => void): this;
|
|
422
916
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
423
917
|
}
|
|
424
|
-
|
|
425
918
|
export interface ClientHttp2Session extends Http2Session {
|
|
919
|
+
/**
|
|
920
|
+
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an
|
|
921
|
+
* HTTP/2 request to the connected server.
|
|
922
|
+
*
|
|
923
|
+
* When a `ClientHttp2Session` is first created, the socket may not yet be
|
|
924
|
+
* connected. if `clienthttp2session.request()` is called during this time, the
|
|
925
|
+
* actual request will be deferred until the socket is ready to go.
|
|
926
|
+
* If the `session` is closed before the actual request be executed, an `ERR_HTTP2_GOAWAY_SESSION` is thrown.
|
|
927
|
+
*
|
|
928
|
+
* This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`.
|
|
929
|
+
*
|
|
930
|
+
* ```js
|
|
931
|
+
* const http2 = require('node:http2');
|
|
932
|
+
* const clientSession = http2.connect('https://localhost:1234');
|
|
933
|
+
* const {
|
|
934
|
+
* HTTP2_HEADER_PATH,
|
|
935
|
+
* HTTP2_HEADER_STATUS,
|
|
936
|
+
* } = http2.constants;
|
|
937
|
+
*
|
|
938
|
+
* const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
|
|
939
|
+
* req.on('response', (headers) => {
|
|
940
|
+
* console.log(headers[HTTP2_HEADER_STATUS]);
|
|
941
|
+
* req.on('data', (chunk) => { // .. });
|
|
942
|
+
* req.on('end', () => { // .. });
|
|
943
|
+
* });
|
|
944
|
+
* ```
|
|
945
|
+
*
|
|
946
|
+
* When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
|
|
947
|
+
* is emitted immediately after queuing the last chunk of payload data to be sent.
|
|
948
|
+
* The `http2stream.sendTrailers()` method can then be called to send trailing
|
|
949
|
+
* headers to the peer.
|
|
950
|
+
*
|
|
951
|
+
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
952
|
+
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
|
953
|
+
*
|
|
954
|
+
* When `options.signal` is set with an `AbortSignal` and then `abort` on the
|
|
955
|
+
* corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error.
|
|
956
|
+
*
|
|
957
|
+
* The `:method` and `:path` pseudo-headers are not specified within `headers`,
|
|
958
|
+
* they respectively default to:
|
|
959
|
+
*
|
|
960
|
+
* * `:method` \= `'GET'`
|
|
961
|
+
* * `:path` \= `/`
|
|
962
|
+
* @since v8.4.0
|
|
963
|
+
*/
|
|
426
964
|
request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
|
|
427
|
-
|
|
428
965
|
addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
|
429
966
|
addListener(event: "origin", listener: (origins: string[]) => void): this;
|
|
430
967
|
addListener(
|
|
@@ -440,9 +977,8 @@ declare module "http2" {
|
|
|
440
977
|
) => void,
|
|
441
978
|
): this;
|
|
442
979
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
443
|
-
|
|
444
980
|
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
|
|
445
|
-
emit(event: "origin", origins:
|
|
981
|
+
emit(event: "origin", origins: readonly string[]): boolean;
|
|
446
982
|
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
|
|
447
983
|
emit(
|
|
448
984
|
event: "stream",
|
|
@@ -451,7 +987,6 @@ declare module "http2" {
|
|
|
451
987
|
flags: number,
|
|
452
988
|
): boolean;
|
|
453
989
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
454
|
-
|
|
455
990
|
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
|
456
991
|
on(event: "origin", listener: (origins: string[]) => void): this;
|
|
457
992
|
on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
|
@@ -464,7 +999,6 @@ declare module "http2" {
|
|
|
464
999
|
) => void,
|
|
465
1000
|
): this;
|
|
466
1001
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
467
|
-
|
|
468
1002
|
once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
|
469
1003
|
once(event: "origin", listener: (origins: string[]) => void): this;
|
|
470
1004
|
once(
|
|
@@ -480,7 +1014,6 @@ declare module "http2" {
|
|
|
480
1014
|
) => void,
|
|
481
1015
|
): this;
|
|
482
1016
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
483
|
-
|
|
484
1017
|
prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
|
485
1018
|
prependListener(event: "origin", listener: (origins: string[]) => void): this;
|
|
486
1019
|
prependListener(
|
|
@@ -496,7 +1029,6 @@ declare module "http2" {
|
|
|
496
1029
|
) => void,
|
|
497
1030
|
): this;
|
|
498
1031
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
499
|
-
|
|
500
1032
|
prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
|
501
1033
|
prependOnceListener(event: "origin", listener: (origins: string[]) => void): this;
|
|
502
1034
|
prependOnceListener(
|
|
@@ -513,17 +1045,103 @@ declare module "http2" {
|
|
|
513
1045
|
): this;
|
|
514
1046
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
515
1047
|
}
|
|
516
|
-
|
|
517
1048
|
export interface AlternativeServiceOptions {
|
|
518
1049
|
origin: number | string | url.URL;
|
|
519
1050
|
}
|
|
520
|
-
|
|
521
1051
|
export interface ServerHttp2Session extends Http2Session {
|
|
522
1052
|
readonly server: Http2Server | Http2SecureServer;
|
|
523
|
-
|
|
1053
|
+
/**
|
|
1054
|
+
* Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
|
|
1055
|
+
*
|
|
1056
|
+
* ```js
|
|
1057
|
+
* const http2 = require('node:http2');
|
|
1058
|
+
*
|
|
1059
|
+
* const server = http2.createServer();
|
|
1060
|
+
* server.on('session', (session) => {
|
|
1061
|
+
* // Set altsvc for origin https://example.org:80
|
|
1062
|
+
* session.altsvc('h2=":8000"', 'https://example.org:80');
|
|
1063
|
+
* });
|
|
1064
|
+
*
|
|
1065
|
+
* server.on('stream', (stream) => {
|
|
1066
|
+
* // Set altsvc for a specific stream
|
|
1067
|
+
* stream.session.altsvc('h2=":8000"', stream.id);
|
|
1068
|
+
* });
|
|
1069
|
+
* ```
|
|
1070
|
+
*
|
|
1071
|
+
* Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate
|
|
1072
|
+
* service is associated with the origin of the given `Http2Stream`.
|
|
1073
|
+
*
|
|
1074
|
+
* The `alt` and origin string _must_ contain only ASCII bytes and are
|
|
1075
|
+
* strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given
|
|
1076
|
+
* domain.
|
|
1077
|
+
*
|
|
1078
|
+
* When a string is passed for the `originOrStream` argument, it will be parsed as
|
|
1079
|
+
* a URL and the origin will be derived. For instance, the origin for the
|
|
1080
|
+
* HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string
|
|
1081
|
+
* cannot be parsed as a URL or if a valid origin cannot be derived.
|
|
1082
|
+
*
|
|
1083
|
+
* A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be
|
|
1084
|
+
* used. The value of the `origin` property _must_ be a properly serialized
|
|
1085
|
+
* ASCII origin.
|
|
1086
|
+
* @since v9.4.0
|
|
1087
|
+
* @param alt A description of the alternative service configuration as defined by `RFC 7838`.
|
|
1088
|
+
* @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the
|
|
1089
|
+
* `http2stream.id` property.
|
|
1090
|
+
*/
|
|
524
1091
|
altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void;
|
|
525
|
-
|
|
526
|
-
|
|
1092
|
+
/**
|
|
1093
|
+
* Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client
|
|
1094
|
+
* to advertise the set of origins for which the server is capable of providing
|
|
1095
|
+
* authoritative responses.
|
|
1096
|
+
*
|
|
1097
|
+
* ```js
|
|
1098
|
+
* const http2 = require('node:http2');
|
|
1099
|
+
* const options = getSecureOptionsSomehow();
|
|
1100
|
+
* const server = http2.createSecureServer(options);
|
|
1101
|
+
* server.on('stream', (stream) => {
|
|
1102
|
+
* stream.respond();
|
|
1103
|
+
* stream.end('ok');
|
|
1104
|
+
* });
|
|
1105
|
+
* server.on('session', (session) => {
|
|
1106
|
+
* session.origin('https://example.com', 'https://example.org');
|
|
1107
|
+
* });
|
|
1108
|
+
* ```
|
|
1109
|
+
*
|
|
1110
|
+
* When a string is passed as an `origin`, it will be parsed as a URL and the
|
|
1111
|
+
* origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string` 'https://example.org'`. An error will be thrown if either the given
|
|
1112
|
+
* string
|
|
1113
|
+
* cannot be parsed as a URL or if a valid origin cannot be derived.
|
|
1114
|
+
*
|
|
1115
|
+
* A `URL` object, or any object with an `origin` property, may be passed as
|
|
1116
|
+
* an `origin`, in which case the value of the `origin` property will be
|
|
1117
|
+
* used. The value of the `origin` property _must_ be a properly serialized
|
|
1118
|
+
* ASCII origin.
|
|
1119
|
+
*
|
|
1120
|
+
* Alternatively, the `origins` option may be used when creating a new HTTP/2
|
|
1121
|
+
* server using the `http2.createSecureServer()` method:
|
|
1122
|
+
*
|
|
1123
|
+
* ```js
|
|
1124
|
+
* const http2 = require('node:http2');
|
|
1125
|
+
* const options = getSecureOptionsSomehow();
|
|
1126
|
+
* options.origins = ['https://example.com', 'https://example.org'];
|
|
1127
|
+
* const server = http2.createSecureServer(options);
|
|
1128
|
+
* server.on('stream', (stream) => {
|
|
1129
|
+
* stream.respond();
|
|
1130
|
+
* stream.end('ok');
|
|
1131
|
+
* });
|
|
1132
|
+
* ```
|
|
1133
|
+
* @since v10.12.0
|
|
1134
|
+
* @param origins One or more URL Strings passed as separate arguments.
|
|
1135
|
+
*/
|
|
1136
|
+
origin(
|
|
1137
|
+
...origins: Array<
|
|
1138
|
+
| string
|
|
1139
|
+
| url.URL
|
|
1140
|
+
| {
|
|
1141
|
+
origin: string;
|
|
1142
|
+
}
|
|
1143
|
+
>
|
|
1144
|
+
): void;
|
|
527
1145
|
addListener(
|
|
528
1146
|
event: "connect",
|
|
529
1147
|
listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
@@ -533,18 +1151,15 @@ declare module "http2" {
|
|
|
533
1151
|
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
534
1152
|
): this;
|
|
535
1153
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
536
|
-
|
|
537
1154
|
emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
|
|
538
1155
|
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
|
539
1156
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
540
|
-
|
|
541
1157
|
on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
|
542
1158
|
on(
|
|
543
1159
|
event: "stream",
|
|
544
1160
|
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
545
1161
|
): this;
|
|
546
1162
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
547
|
-
|
|
548
1163
|
once(
|
|
549
1164
|
event: "connect",
|
|
550
1165
|
listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
@@ -554,7 +1169,6 @@ declare module "http2" {
|
|
|
554
1169
|
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
555
1170
|
): this;
|
|
556
1171
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
557
|
-
|
|
558
1172
|
prependListener(
|
|
559
1173
|
event: "connect",
|
|
560
1174
|
listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
@@ -564,7 +1178,6 @@ declare module "http2" {
|
|
|
564
1178
|
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
565
1179
|
): this;
|
|
566
1180
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
567
|
-
|
|
568
1181
|
prependOnceListener(
|
|
569
1182
|
event: "connect",
|
|
570
1183
|
listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
@@ -575,9 +1188,7 @@ declare module "http2" {
|
|
|
575
1188
|
): this;
|
|
576
1189
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
577
1190
|
}
|
|
578
|
-
|
|
579
1191
|
// Http2Server
|
|
580
|
-
|
|
581
1192
|
export interface SessionOptions {
|
|
582
1193
|
maxDeflateDynamicTableSize?: number | undefined;
|
|
583
1194
|
maxSessionMemory?: number | undefined;
|
|
@@ -587,34 +1198,43 @@ declare module "http2" {
|
|
|
587
1198
|
paddingStrategy?: number | undefined;
|
|
588
1199
|
peerMaxConcurrentStreams?: number | undefined;
|
|
589
1200
|
settings?: Settings | undefined;
|
|
590
|
-
|
|
1201
|
+
remoteCustomSettings?: number[] | undefined;
|
|
1202
|
+
/**
|
|
1203
|
+
* Specifies a timeout in milliseconds that
|
|
1204
|
+
* a server should wait when an [`'unknownProtocol'`][] is emitted. If the
|
|
1205
|
+
* socket has not been destroyed by that time the server will destroy it.
|
|
1206
|
+
* @default 100000
|
|
1207
|
+
*/
|
|
1208
|
+
unknownProtocolTimeout?: number | undefined;
|
|
591
1209
|
selectPadding?(frameLen: number, maxFrameLen: number): number;
|
|
592
1210
|
}
|
|
593
|
-
|
|
594
1211
|
export interface ClientSessionOptions extends SessionOptions {
|
|
595
1212
|
maxReservedRemoteStreams?: number | undefined;
|
|
596
1213
|
createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
|
|
597
1214
|
protocol?: "http:" | "https:" | undefined;
|
|
598
1215
|
}
|
|
599
|
-
|
|
600
1216
|
export interface ServerSessionOptions extends SessionOptions {
|
|
601
1217
|
Http1IncomingMessage?: typeof IncomingMessage | undefined;
|
|
602
1218
|
Http1ServerResponse?: typeof ServerResponse | undefined;
|
|
603
1219
|
Http2ServerRequest?: typeof Http2ServerRequest | undefined;
|
|
604
1220
|
Http2ServerResponse?: typeof Http2ServerResponse | undefined;
|
|
605
1221
|
}
|
|
606
|
-
|
|
607
1222
|
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
|
|
608
1223
|
export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {}
|
|
609
|
-
|
|
610
1224
|
export interface ServerOptions extends ServerSessionOptions {}
|
|
611
|
-
|
|
612
1225
|
export interface SecureServerOptions extends SecureServerSessionOptions {
|
|
613
1226
|
allowHTTP1?: boolean | undefined;
|
|
614
1227
|
origins?: string[] | undefined;
|
|
615
1228
|
}
|
|
616
|
-
|
|
617
|
-
|
|
1229
|
+
interface HTTP2ServerCommon {
|
|
1230
|
+
setTimeout(msec?: number, callback?: () => void): this;
|
|
1231
|
+
/**
|
|
1232
|
+
* Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
|
|
1233
|
+
* Throws ERR_INVALID_ARG_TYPE for invalid settings argument.
|
|
1234
|
+
*/
|
|
1235
|
+
updateSettings(settings: Settings): void;
|
|
1236
|
+
}
|
|
1237
|
+
export interface Http2Server extends net.Server, HTTP2ServerCommon {
|
|
618
1238
|
addListener(
|
|
619
1239
|
event: "checkContinue",
|
|
620
1240
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -631,7 +1251,6 @@ declare module "http2" {
|
|
|
631
1251
|
): this;
|
|
632
1252
|
addListener(event: "timeout", listener: () => void): this;
|
|
633
1253
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
634
|
-
|
|
635
1254
|
emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
|
636
1255
|
emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
|
637
1256
|
emit(event: "session", session: ServerHttp2Session): boolean;
|
|
@@ -639,7 +1258,6 @@ declare module "http2" {
|
|
|
639
1258
|
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
|
640
1259
|
emit(event: "timeout"): boolean;
|
|
641
1260
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
642
|
-
|
|
643
1261
|
on(
|
|
644
1262
|
event: "checkContinue",
|
|
645
1263
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -653,7 +1271,6 @@ declare module "http2" {
|
|
|
653
1271
|
): this;
|
|
654
1272
|
on(event: "timeout", listener: () => void): this;
|
|
655
1273
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
656
|
-
|
|
657
1274
|
once(
|
|
658
1275
|
event: "checkContinue",
|
|
659
1276
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -667,7 +1284,6 @@ declare module "http2" {
|
|
|
667
1284
|
): this;
|
|
668
1285
|
once(event: "timeout", listener: () => void): this;
|
|
669
1286
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
670
|
-
|
|
671
1287
|
prependListener(
|
|
672
1288
|
event: "checkContinue",
|
|
673
1289
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -684,7 +1300,6 @@ declare module "http2" {
|
|
|
684
1300
|
): this;
|
|
685
1301
|
prependListener(event: "timeout", listener: () => void): this;
|
|
686
1302
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
687
|
-
|
|
688
1303
|
prependOnceListener(
|
|
689
1304
|
event: "checkContinue",
|
|
690
1305
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -701,11 +1316,8 @@ declare module "http2" {
|
|
|
701
1316
|
): this;
|
|
702
1317
|
prependOnceListener(event: "timeout", listener: () => void): this;
|
|
703
1318
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
704
|
-
|
|
705
|
-
setTimeout(msec?: number, callback?: () => void): this;
|
|
706
1319
|
}
|
|
707
|
-
|
|
708
|
-
export interface Http2SecureServer extends tls.Server {
|
|
1320
|
+
export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
|
|
709
1321
|
addListener(
|
|
710
1322
|
event: "checkContinue",
|
|
711
1323
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -723,7 +1335,6 @@ declare module "http2" {
|
|
|
723
1335
|
addListener(event: "timeout", listener: () => void): this;
|
|
724
1336
|
addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
|
725
1337
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
726
|
-
|
|
727
1338
|
emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
|
728
1339
|
emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
|
729
1340
|
emit(event: "session", session: ServerHttp2Session): boolean;
|
|
@@ -732,7 +1343,6 @@ declare module "http2" {
|
|
|
732
1343
|
emit(event: "timeout"): boolean;
|
|
733
1344
|
emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
|
|
734
1345
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
735
|
-
|
|
736
1346
|
on(
|
|
737
1347
|
event: "checkContinue",
|
|
738
1348
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -747,7 +1357,6 @@ declare module "http2" {
|
|
|
747
1357
|
on(event: "timeout", listener: () => void): this;
|
|
748
1358
|
on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
|
749
1359
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
750
|
-
|
|
751
1360
|
once(
|
|
752
1361
|
event: "checkContinue",
|
|
753
1362
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -762,7 +1371,6 @@ declare module "http2" {
|
|
|
762
1371
|
once(event: "timeout", listener: () => void): this;
|
|
763
1372
|
once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
|
764
1373
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
765
|
-
|
|
766
1374
|
prependListener(
|
|
767
1375
|
event: "checkContinue",
|
|
768
1376
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -780,7 +1388,6 @@ declare module "http2" {
|
|
|
780
1388
|
prependListener(event: "timeout", listener: () => void): this;
|
|
781
1389
|
prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
|
782
1390
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
783
|
-
|
|
784
1391
|
prependOnceListener(
|
|
785
1392
|
event: "checkContinue",
|
|
786
1393
|
listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
@@ -798,38 +1405,205 @@ declare module "http2" {
|
|
|
798
1405
|
prependOnceListener(event: "timeout", listener: () => void): this;
|
|
799
1406
|
prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
|
800
1407
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
801
|
-
|
|
802
|
-
setTimeout(msec?: number, callback?: () => void): this;
|
|
803
1408
|
}
|
|
804
|
-
|
|
1409
|
+
/**
|
|
1410
|
+
* A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status,
|
|
1411
|
+
* headers, and
|
|
1412
|
+
* data.
|
|
1413
|
+
* @since v8.4.0
|
|
1414
|
+
*/
|
|
805
1415
|
export class Http2ServerRequest extends stream.Readable {
|
|
806
1416
|
constructor(
|
|
807
1417
|
stream: ServerHttp2Stream,
|
|
808
1418
|
headers: IncomingHttpHeaders,
|
|
809
1419
|
options: stream.ReadableOptions,
|
|
810
|
-
rawHeaders:
|
|
1420
|
+
rawHeaders: readonly string[],
|
|
811
1421
|
);
|
|
812
|
-
|
|
1422
|
+
/**
|
|
1423
|
+
* The `request.aborted` property will be `true` if the request has
|
|
1424
|
+
* been aborted.
|
|
1425
|
+
* @since v10.1.0
|
|
1426
|
+
*/
|
|
813
1427
|
readonly aborted: boolean;
|
|
1428
|
+
/**
|
|
1429
|
+
* The request authority pseudo header field. Because HTTP/2 allows requests
|
|
1430
|
+
* to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`.
|
|
1431
|
+
* @since v8.4.0
|
|
1432
|
+
*/
|
|
814
1433
|
readonly authority: string;
|
|
1434
|
+
/**
|
|
1435
|
+
* See `request.socket`.
|
|
1436
|
+
* @since v8.4.0
|
|
1437
|
+
* @deprecated Since v13.0.0 - Use `socket`.
|
|
1438
|
+
*/
|
|
815
1439
|
readonly connection: net.Socket | tls.TLSSocket;
|
|
1440
|
+
/**
|
|
1441
|
+
* The `request.complete` property will be `true` if the request has
|
|
1442
|
+
* been completed, aborted, or destroyed.
|
|
1443
|
+
* @since v12.10.0
|
|
1444
|
+
*/
|
|
816
1445
|
readonly complete: boolean;
|
|
1446
|
+
/**
|
|
1447
|
+
* The request/response headers object.
|
|
1448
|
+
*
|
|
1449
|
+
* Key-value pairs of header names and values. Header names are lower-cased.
|
|
1450
|
+
*
|
|
1451
|
+
* ```js
|
|
1452
|
+
* // Prints something like:
|
|
1453
|
+
* //
|
|
1454
|
+
* // { 'user-agent': 'curl/7.22.0',
|
|
1455
|
+
* // host: '127.0.0.1:8000',
|
|
1456
|
+
* // accept: '*' }
|
|
1457
|
+
* console.log(request.headers);
|
|
1458
|
+
* ```
|
|
1459
|
+
*
|
|
1460
|
+
* See `HTTP/2 Headers Object`.
|
|
1461
|
+
*
|
|
1462
|
+
* In HTTP/2, the request path, host name, protocol, and method are represented as
|
|
1463
|
+
* special headers prefixed with the `:` character (e.g. `':path'`). These special
|
|
1464
|
+
* headers will be included in the `request.headers` object. Care must be taken not
|
|
1465
|
+
* to inadvertently modify these special headers or errors may occur. For instance,
|
|
1466
|
+
* removing all headers from the request will cause errors to occur:
|
|
1467
|
+
*
|
|
1468
|
+
* ```js
|
|
1469
|
+
* removeAllHeaders(request.headers);
|
|
1470
|
+
* assert(request.url); // Fails because the :path header has been removed
|
|
1471
|
+
* ```
|
|
1472
|
+
* @since v8.4.0
|
|
1473
|
+
*/
|
|
817
1474
|
readonly headers: IncomingHttpHeaders;
|
|
1475
|
+
/**
|
|
1476
|
+
* In case of server request, the HTTP version sent by the client. In the case of
|
|
1477
|
+
* client response, the HTTP version of the connected-to server. Returns `'2.0'`.
|
|
1478
|
+
*
|
|
1479
|
+
* Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
|
|
1480
|
+
* @since v8.4.0
|
|
1481
|
+
*/
|
|
818
1482
|
readonly httpVersion: string;
|
|
819
1483
|
readonly httpVersionMinor: number;
|
|
820
1484
|
readonly httpVersionMajor: number;
|
|
1485
|
+
/**
|
|
1486
|
+
* The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`.
|
|
1487
|
+
* @since v8.4.0
|
|
1488
|
+
*/
|
|
821
1489
|
readonly method: string;
|
|
1490
|
+
/**
|
|
1491
|
+
* The raw request/response headers list exactly as they were received.
|
|
1492
|
+
*
|
|
1493
|
+
* The keys and values are in the same list. It is _not_ a
|
|
1494
|
+
* list of tuples. So, the even-numbered offsets are key values, and the
|
|
1495
|
+
* odd-numbered offsets are the associated values.
|
|
1496
|
+
*
|
|
1497
|
+
* Header names are not lowercased, and duplicates are not merged.
|
|
1498
|
+
*
|
|
1499
|
+
* ```js
|
|
1500
|
+
* // Prints something like:
|
|
1501
|
+
* //
|
|
1502
|
+
* // [ 'user-agent',
|
|
1503
|
+
* // 'this is invalid because there can be only one',
|
|
1504
|
+
* // 'User-Agent',
|
|
1505
|
+
* // 'curl/7.22.0',
|
|
1506
|
+
* // 'Host',
|
|
1507
|
+
* // '127.0.0.1:8000',
|
|
1508
|
+
* // 'ACCEPT',
|
|
1509
|
+
* // '*' ]
|
|
1510
|
+
* console.log(request.rawHeaders);
|
|
1511
|
+
* ```
|
|
1512
|
+
* @since v8.4.0
|
|
1513
|
+
*/
|
|
822
1514
|
readonly rawHeaders: string[];
|
|
1515
|
+
/**
|
|
1516
|
+
* The raw request/response trailer keys and values exactly as they were
|
|
1517
|
+
* received. Only populated at the `'end'` event.
|
|
1518
|
+
* @since v8.4.0
|
|
1519
|
+
*/
|
|
823
1520
|
readonly rawTrailers: string[];
|
|
1521
|
+
/**
|
|
1522
|
+
* The request scheme pseudo header field indicating the scheme
|
|
1523
|
+
* portion of the target URL.
|
|
1524
|
+
* @since v8.4.0
|
|
1525
|
+
*/
|
|
824
1526
|
readonly scheme: string;
|
|
1527
|
+
/**
|
|
1528
|
+
* Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
|
|
1529
|
+
* applies getters, setters, and methods based on HTTP/2 logic.
|
|
1530
|
+
*
|
|
1531
|
+
* `destroyed`, `readable`, and `writable` properties will be retrieved from and
|
|
1532
|
+
* set on `request.stream`.
|
|
1533
|
+
*
|
|
1534
|
+
* `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`.
|
|
1535
|
+
*
|
|
1536
|
+
* `setTimeout` method will be called on `request.stream.session`.
|
|
1537
|
+
*
|
|
1538
|
+
* `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
|
|
1539
|
+
* more information.
|
|
1540
|
+
*
|
|
1541
|
+
* All other interactions will be routed directly to the socket. With TLS support,
|
|
1542
|
+
* use `request.socket.getPeerCertificate()` to obtain the client's
|
|
1543
|
+
* authentication details.
|
|
1544
|
+
* @since v8.4.0
|
|
1545
|
+
*/
|
|
825
1546
|
readonly socket: net.Socket | tls.TLSSocket;
|
|
1547
|
+
/**
|
|
1548
|
+
* The `Http2Stream` object backing the request.
|
|
1549
|
+
* @since v8.4.0
|
|
1550
|
+
*/
|
|
826
1551
|
readonly stream: ServerHttp2Stream;
|
|
1552
|
+
/**
|
|
1553
|
+
* The request/response trailers object. Only populated at the `'end'` event.
|
|
1554
|
+
* @since v8.4.0
|
|
1555
|
+
*/
|
|
827
1556
|
readonly trailers: IncomingHttpHeaders;
|
|
1557
|
+
/**
|
|
1558
|
+
* Request URL string. This contains only the URL that is present in the actual
|
|
1559
|
+
* HTTP request. If the request is:
|
|
1560
|
+
*
|
|
1561
|
+
* ```http
|
|
1562
|
+
* GET /status?name=ryan HTTP/1.1
|
|
1563
|
+
* Accept: text/plain
|
|
1564
|
+
* ```
|
|
1565
|
+
*
|
|
1566
|
+
* Then `request.url` will be:
|
|
1567
|
+
*
|
|
1568
|
+
* ```js
|
|
1569
|
+
* '/status?name=ryan'
|
|
1570
|
+
* ```
|
|
1571
|
+
*
|
|
1572
|
+
* To parse the url into its parts, `new URL()` can be used:
|
|
1573
|
+
*
|
|
1574
|
+
* ```console
|
|
1575
|
+
* $ node
|
|
1576
|
+
* > new URL('/status?name=ryan', 'http://example.com')
|
|
1577
|
+
* URL {
|
|
1578
|
+
* href: 'http://example.com/status?name=ryan',
|
|
1579
|
+
* origin: 'http://example.com',
|
|
1580
|
+
* protocol: 'http:',
|
|
1581
|
+
* username: '',
|
|
1582
|
+
* password: '',
|
|
1583
|
+
* host: 'example.com',
|
|
1584
|
+
* hostname: 'example.com',
|
|
1585
|
+
* port: '',
|
|
1586
|
+
* pathname: '/status',
|
|
1587
|
+
* search: '?name=ryan',
|
|
1588
|
+
* searchParams: URLSearchParams { 'name' => 'ryan' },
|
|
1589
|
+
* hash: ''
|
|
1590
|
+
* }
|
|
1591
|
+
* ```
|
|
1592
|
+
* @since v8.4.0
|
|
1593
|
+
*/
|
|
828
1594
|
url: string;
|
|
829
|
-
|
|
1595
|
+
/**
|
|
1596
|
+
* Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is
|
|
1597
|
+
* provided, then it is added as a listener on the `'timeout'` event on
|
|
1598
|
+
* the response object.
|
|
1599
|
+
*
|
|
1600
|
+
* If no `'timeout'` listener is added to the request, the response, or
|
|
1601
|
+
* the server, then `Http2Stream`s are destroyed when they time out. If a
|
|
1602
|
+
* handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
|
|
1603
|
+
* @since v8.4.0
|
|
1604
|
+
*/
|
|
830
1605
|
setTimeout(msecs: number, callback?: () => void): void;
|
|
831
1606
|
read(size?: number): Buffer | string | null;
|
|
832
|
-
|
|
833
1607
|
addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
|
834
1608
|
addListener(event: "close", listener: () => void): this;
|
|
835
1609
|
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -837,7 +1611,6 @@ declare module "http2" {
|
|
|
837
1611
|
addListener(event: "readable", listener: () => void): this;
|
|
838
1612
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
839
1613
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
840
|
-
|
|
841
1614
|
emit(event: "aborted", hadError: boolean, code: number): boolean;
|
|
842
1615
|
emit(event: "close"): boolean;
|
|
843
1616
|
emit(event: "data", chunk: Buffer | string): boolean;
|
|
@@ -845,7 +1618,6 @@ declare module "http2" {
|
|
|
845
1618
|
emit(event: "readable"): boolean;
|
|
846
1619
|
emit(event: "error", err: Error): boolean;
|
|
847
1620
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
848
|
-
|
|
849
1621
|
on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
|
850
1622
|
on(event: "close", listener: () => void): this;
|
|
851
1623
|
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -853,7 +1625,6 @@ declare module "http2" {
|
|
|
853
1625
|
on(event: "readable", listener: () => void): this;
|
|
854
1626
|
on(event: "error", listener: (err: Error) => void): this;
|
|
855
1627
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
856
|
-
|
|
857
1628
|
once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
|
858
1629
|
once(event: "close", listener: () => void): this;
|
|
859
1630
|
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -861,7 +1632,6 @@ declare module "http2" {
|
|
|
861
1632
|
once(event: "readable", listener: () => void): this;
|
|
862
1633
|
once(event: "error", listener: (err: Error) => void): this;
|
|
863
1634
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
864
|
-
|
|
865
1635
|
prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
|
866
1636
|
prependListener(event: "close", listener: () => void): this;
|
|
867
1637
|
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -869,7 +1639,6 @@ declare module "http2" {
|
|
|
869
1639
|
prependListener(event: "readable", listener: () => void): this;
|
|
870
1640
|
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
871
1641
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
872
|
-
|
|
873
1642
|
prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
|
874
1643
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
875
1644
|
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
@@ -878,39 +1647,375 @@ declare module "http2" {
|
|
|
878
1647
|
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
879
1648
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
880
1649
|
}
|
|
881
|
-
|
|
1650
|
+
/**
|
|
1651
|
+
* This object is created internally by an HTTP server, not by the user. It is
|
|
1652
|
+
* passed as the second parameter to the `'request'` event.
|
|
1653
|
+
* @since v8.4.0
|
|
1654
|
+
*/
|
|
882
1655
|
export class Http2ServerResponse extends stream.Writable {
|
|
883
1656
|
constructor(stream: ServerHttp2Stream);
|
|
884
|
-
|
|
1657
|
+
/**
|
|
1658
|
+
* See `response.socket`.
|
|
1659
|
+
* @since v8.4.0
|
|
1660
|
+
* @deprecated Since v13.0.0 - Use `socket`.
|
|
1661
|
+
*/
|
|
885
1662
|
readonly connection: net.Socket | tls.TLSSocket;
|
|
1663
|
+
/**
|
|
1664
|
+
* Append a single header value to the header object.
|
|
1665
|
+
*
|
|
1666
|
+
* If the value is an array, this is equivalent to calling this method multiple times.
|
|
1667
|
+
*
|
|
1668
|
+
* If there were no previous values for the header, this is equivalent to calling {@link setHeader}.
|
|
1669
|
+
*
|
|
1670
|
+
* Attempting to set a header field name or value that contains invalid characters will result in a
|
|
1671
|
+
* [TypeError](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-typeerror) being thrown.
|
|
1672
|
+
*
|
|
1673
|
+
* ```js
|
|
1674
|
+
* // Returns headers including "set-cookie: a" and "set-cookie: b"
|
|
1675
|
+
* const server = http2.createServer((req, res) => {
|
|
1676
|
+
* res.setHeader('set-cookie', 'a');
|
|
1677
|
+
* res.appendHeader('set-cookie', 'b');
|
|
1678
|
+
* res.writeHead(200);
|
|
1679
|
+
* res.end('ok');
|
|
1680
|
+
* });
|
|
1681
|
+
* ```
|
|
1682
|
+
* @since v20.12.0
|
|
1683
|
+
*/
|
|
1684
|
+
appendHeader(name: string, value: string | string[]): void;
|
|
1685
|
+
/**
|
|
1686
|
+
* Boolean value that indicates whether the response has completed. Starts
|
|
1687
|
+
* as `false`. After `response.end()` executes, the value will be `true`.
|
|
1688
|
+
* @since v8.4.0
|
|
1689
|
+
* @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`.
|
|
1690
|
+
*/
|
|
886
1691
|
readonly finished: boolean;
|
|
1692
|
+
/**
|
|
1693
|
+
* True if headers were sent, false otherwise (read-only).
|
|
1694
|
+
* @since v8.4.0
|
|
1695
|
+
*/
|
|
887
1696
|
readonly headersSent: boolean;
|
|
1697
|
+
/**
|
|
1698
|
+
* A reference to the original HTTP2 `request` object.
|
|
1699
|
+
* @since v15.7.0
|
|
1700
|
+
*/
|
|
1701
|
+
readonly req: Http2ServerRequest;
|
|
1702
|
+
/**
|
|
1703
|
+
* Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
|
|
1704
|
+
* applies getters, setters, and methods based on HTTP/2 logic.
|
|
1705
|
+
*
|
|
1706
|
+
* `destroyed`, `readable`, and `writable` properties will be retrieved from and
|
|
1707
|
+
* set on `response.stream`.
|
|
1708
|
+
*
|
|
1709
|
+
* `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`.
|
|
1710
|
+
*
|
|
1711
|
+
* `setTimeout` method will be called on `response.stream.session`.
|
|
1712
|
+
*
|
|
1713
|
+
* `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
|
|
1714
|
+
* more information.
|
|
1715
|
+
*
|
|
1716
|
+
* All other interactions will be routed directly to the socket.
|
|
1717
|
+
*
|
|
1718
|
+
* ```js
|
|
1719
|
+
* const http2 = require('node:http2');
|
|
1720
|
+
* const server = http2.createServer((req, res) => {
|
|
1721
|
+
* const ip = req.socket.remoteAddress;
|
|
1722
|
+
* const port = req.socket.remotePort;
|
|
1723
|
+
* res.end(`Your IP address is ${ip} and your source port is ${port}.`);
|
|
1724
|
+
* }).listen(3000);
|
|
1725
|
+
* ```
|
|
1726
|
+
* @since v8.4.0
|
|
1727
|
+
*/
|
|
888
1728
|
readonly socket: net.Socket | tls.TLSSocket;
|
|
1729
|
+
/**
|
|
1730
|
+
* The `Http2Stream` object backing the response.
|
|
1731
|
+
* @since v8.4.0
|
|
1732
|
+
*/
|
|
889
1733
|
readonly stream: ServerHttp2Stream;
|
|
1734
|
+
/**
|
|
1735
|
+
* When true, the Date header will be automatically generated and sent in
|
|
1736
|
+
* the response if it is not already present in the headers. Defaults to true.
|
|
1737
|
+
*
|
|
1738
|
+
* This should only be disabled for testing; HTTP requires the Date header
|
|
1739
|
+
* in responses.
|
|
1740
|
+
* @since v8.4.0
|
|
1741
|
+
*/
|
|
890
1742
|
sendDate: boolean;
|
|
1743
|
+
/**
|
|
1744
|
+
* When using implicit headers (not calling `response.writeHead()` explicitly),
|
|
1745
|
+
* this property controls the status code that will be sent to the client when
|
|
1746
|
+
* the headers get flushed.
|
|
1747
|
+
*
|
|
1748
|
+
* ```js
|
|
1749
|
+
* response.statusCode = 404;
|
|
1750
|
+
* ```
|
|
1751
|
+
*
|
|
1752
|
+
* After response header was sent to the client, this property indicates the
|
|
1753
|
+
* status code which was sent out.
|
|
1754
|
+
* @since v8.4.0
|
|
1755
|
+
*/
|
|
891
1756
|
statusCode: number;
|
|
1757
|
+
/**
|
|
1758
|
+
* Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns
|
|
1759
|
+
* an empty string.
|
|
1760
|
+
* @since v8.4.0
|
|
1761
|
+
*/
|
|
892
1762
|
statusMessage: "";
|
|
1763
|
+
/**
|
|
1764
|
+
* This method adds HTTP trailing headers (a header but at the end of the
|
|
1765
|
+
* message) to the response.
|
|
1766
|
+
*
|
|
1767
|
+
* Attempting to set a header field name or value that contains invalid characters
|
|
1768
|
+
* will result in a `TypeError` being thrown.
|
|
1769
|
+
* @since v8.4.0
|
|
1770
|
+
*/
|
|
893
1771
|
addTrailers(trailers: OutgoingHttpHeaders): void;
|
|
1772
|
+
/**
|
|
1773
|
+
* This method signals to the server that all of the response headers and body
|
|
1774
|
+
* have been sent; that server should consider this message complete.
|
|
1775
|
+
* The method, `response.end()`, MUST be called on each response.
|
|
1776
|
+
*
|
|
1777
|
+
* If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`.
|
|
1778
|
+
*
|
|
1779
|
+
* If `callback` is specified, it will be called when the response stream
|
|
1780
|
+
* is finished.
|
|
1781
|
+
* @since v8.4.0
|
|
1782
|
+
*/
|
|
894
1783
|
end(callback?: () => void): this;
|
|
895
1784
|
end(data: string | Uint8Array, callback?: () => void): this;
|
|
896
1785
|
end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this;
|
|
1786
|
+
/**
|
|
1787
|
+
* Reads out a header that has already been queued but not sent to the client.
|
|
1788
|
+
* The name is case-insensitive.
|
|
1789
|
+
*
|
|
1790
|
+
* ```js
|
|
1791
|
+
* const contentType = response.getHeader('content-type');
|
|
1792
|
+
* ```
|
|
1793
|
+
* @since v8.4.0
|
|
1794
|
+
*/
|
|
897
1795
|
getHeader(name: string): string;
|
|
1796
|
+
/**
|
|
1797
|
+
* Returns an array containing the unique names of the current outgoing headers.
|
|
1798
|
+
* All header names are lowercase.
|
|
1799
|
+
*
|
|
1800
|
+
* ```js
|
|
1801
|
+
* response.setHeader('Foo', 'bar');
|
|
1802
|
+
* response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
|
|
1803
|
+
*
|
|
1804
|
+
* const headerNames = response.getHeaderNames();
|
|
1805
|
+
* // headerNames === ['foo', 'set-cookie']
|
|
1806
|
+
* ```
|
|
1807
|
+
* @since v8.4.0
|
|
1808
|
+
*/
|
|
898
1809
|
getHeaderNames(): string[];
|
|
1810
|
+
/**
|
|
1811
|
+
* Returns a shallow copy of the current outgoing headers. Since a shallow copy
|
|
1812
|
+
* is used, array values may be mutated without additional calls to various
|
|
1813
|
+
* header-related http module methods. The keys of the returned object are the
|
|
1814
|
+
* header names and the values are the respective header values. All header names
|
|
1815
|
+
* are lowercase.
|
|
1816
|
+
*
|
|
1817
|
+
* The object returned by the `response.getHeaders()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`,
|
|
1818
|
+
* `obj.hasOwnProperty()`, and others
|
|
1819
|
+
* are not defined and _will not work_.
|
|
1820
|
+
*
|
|
1821
|
+
* ```js
|
|
1822
|
+
* response.setHeader('Foo', 'bar');
|
|
1823
|
+
* response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
|
|
1824
|
+
*
|
|
1825
|
+
* const headers = response.getHeaders();
|
|
1826
|
+
* // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
|
|
1827
|
+
* ```
|
|
1828
|
+
* @since v8.4.0
|
|
1829
|
+
*/
|
|
899
1830
|
getHeaders(): OutgoingHttpHeaders;
|
|
1831
|
+
/**
|
|
1832
|
+
* Returns `true` if the header identified by `name` is currently set in the
|
|
1833
|
+
* outgoing headers. The header name matching is case-insensitive.
|
|
1834
|
+
*
|
|
1835
|
+
* ```js
|
|
1836
|
+
* const hasContentType = response.hasHeader('content-type');
|
|
1837
|
+
* ```
|
|
1838
|
+
* @since v8.4.0
|
|
1839
|
+
*/
|
|
900
1840
|
hasHeader(name: string): boolean;
|
|
1841
|
+
/**
|
|
1842
|
+
* Removes a header that has been queued for implicit sending.
|
|
1843
|
+
*
|
|
1844
|
+
* ```js
|
|
1845
|
+
* response.removeHeader('Content-Encoding');
|
|
1846
|
+
* ```
|
|
1847
|
+
* @since v8.4.0
|
|
1848
|
+
*/
|
|
901
1849
|
removeHeader(name: string): void;
|
|
902
|
-
|
|
1850
|
+
/**
|
|
1851
|
+
* Sets a single header value for implicit headers. If this header already exists
|
|
1852
|
+
* in the to-be-sent headers, its value will be replaced. Use an array of strings
|
|
1853
|
+
* here to send multiple headers with the same name.
|
|
1854
|
+
*
|
|
1855
|
+
* ```js
|
|
1856
|
+
* response.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
1857
|
+
* ```
|
|
1858
|
+
*
|
|
1859
|
+
* or
|
|
1860
|
+
*
|
|
1861
|
+
* ```js
|
|
1862
|
+
* response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
|
|
1863
|
+
* ```
|
|
1864
|
+
*
|
|
1865
|
+
* Attempting to set a header field name or value that contains invalid characters
|
|
1866
|
+
* will result in a `TypeError` being thrown.
|
|
1867
|
+
*
|
|
1868
|
+
* When headers have been set with `response.setHeader()`, they will be merged
|
|
1869
|
+
* with any headers passed to `response.writeHead()`, with the headers passed
|
|
1870
|
+
* to `response.writeHead()` given precedence.
|
|
1871
|
+
*
|
|
1872
|
+
* ```js
|
|
1873
|
+
* // Returns content-type = text/plain
|
|
1874
|
+
* const server = http2.createServer((req, res) => {
|
|
1875
|
+
* res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
1876
|
+
* res.setHeader('X-Foo', 'bar');
|
|
1877
|
+
* res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
1878
|
+
* res.end('ok');
|
|
1879
|
+
* });
|
|
1880
|
+
* ```
|
|
1881
|
+
* @since v8.4.0
|
|
1882
|
+
*/
|
|
1883
|
+
setHeader(name: string, value: number | string | readonly string[]): void;
|
|
1884
|
+
/**
|
|
1885
|
+
* Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is
|
|
1886
|
+
* provided, then it is added as a listener on the `'timeout'` event on
|
|
1887
|
+
* the response object.
|
|
1888
|
+
*
|
|
1889
|
+
* If no `'timeout'` listener is added to the request, the response, or
|
|
1890
|
+
* the server, then `Http2Stream` s are destroyed when they time out. If a
|
|
1891
|
+
* handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly.
|
|
1892
|
+
* @since v8.4.0
|
|
1893
|
+
*/
|
|
903
1894
|
setTimeout(msecs: number, callback?: () => void): void;
|
|
1895
|
+
/**
|
|
1896
|
+
* If this method is called and `response.writeHead()` has not been called,
|
|
1897
|
+
* it will switch to implicit header mode and flush the implicit headers.
|
|
1898
|
+
*
|
|
1899
|
+
* This sends a chunk of the response body. This method may
|
|
1900
|
+
* be called multiple times to provide successive parts of the body.
|
|
1901
|
+
*
|
|
1902
|
+
* In the `node:http` module, the response body is omitted when the
|
|
1903
|
+
* request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body.
|
|
1904
|
+
*
|
|
1905
|
+
* `chunk` can be a string or a buffer. If `chunk` is a string,
|
|
1906
|
+
* the second parameter specifies how to encode it into a byte stream.
|
|
1907
|
+
* By default the `encoding` is `'utf8'`. `callback` will be called when this chunk
|
|
1908
|
+
* of data is flushed.
|
|
1909
|
+
*
|
|
1910
|
+
* This is the raw HTTP body and has nothing to do with higher-level multi-part
|
|
1911
|
+
* body encodings that may be used.
|
|
1912
|
+
*
|
|
1913
|
+
* The first time `response.write()` is called, it will send the buffered
|
|
1914
|
+
* header information and the first chunk of the body to the client. The second
|
|
1915
|
+
* time `response.write()` is called, Node.js assumes data will be streamed,
|
|
1916
|
+
* and sends the new data separately. That is, the response is buffered up to the
|
|
1917
|
+
* first chunk of the body.
|
|
1918
|
+
*
|
|
1919
|
+
* Returns `true` if the entire data was flushed successfully to the kernel
|
|
1920
|
+
* buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again.
|
|
1921
|
+
* @since v8.4.0
|
|
1922
|
+
*/
|
|
904
1923
|
write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
|
|
905
1924
|
write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean;
|
|
1925
|
+
/**
|
|
1926
|
+
* Sends a status `100 Continue` to the client, indicating that the request body
|
|
1927
|
+
* should be sent. See the `'checkContinue'` event on `Http2Server` and `Http2SecureServer`.
|
|
1928
|
+
* @since v8.4.0
|
|
1929
|
+
*/
|
|
906
1930
|
writeContinue(): void;
|
|
1931
|
+
/**
|
|
1932
|
+
* Sends a status `103 Early Hints` to the client with a Link header,
|
|
1933
|
+
* indicating that the user agent can preload/preconnect the linked resources.
|
|
1934
|
+
* The `hints` is an object containing the values of headers to be sent with
|
|
1935
|
+
* early hints message.
|
|
1936
|
+
*
|
|
1937
|
+
* **Example**
|
|
1938
|
+
*
|
|
1939
|
+
* ```js
|
|
1940
|
+
* const earlyHintsLink = '</styles.css>; rel=preload; as=style';
|
|
1941
|
+
* response.writeEarlyHints({
|
|
1942
|
+
* 'link': earlyHintsLink,
|
|
1943
|
+
* });
|
|
1944
|
+
*
|
|
1945
|
+
* const earlyHintsLinks = [
|
|
1946
|
+
* '</styles.css>; rel=preload; as=style',
|
|
1947
|
+
* '</scripts.js>; rel=preload; as=script',
|
|
1948
|
+
* ];
|
|
1949
|
+
* response.writeEarlyHints({
|
|
1950
|
+
* 'link': earlyHintsLinks,
|
|
1951
|
+
* });
|
|
1952
|
+
* ```
|
|
1953
|
+
* @since v18.11.0
|
|
1954
|
+
*/
|
|
1955
|
+
writeEarlyHints(hints: Record<string, string | string[]>): void;
|
|
1956
|
+
/**
|
|
1957
|
+
* Sends a response header to the request. The status code is a 3-digit HTTP
|
|
1958
|
+
* status code, like `404`. The last argument, `headers`, are the response headers.
|
|
1959
|
+
*
|
|
1960
|
+
* Returns a reference to the `Http2ServerResponse`, so that calls can be chained.
|
|
1961
|
+
*
|
|
1962
|
+
* For compatibility with `HTTP/1`, a human-readable `statusMessage` may be
|
|
1963
|
+
* passed as the second argument. However, because the `statusMessage` has no
|
|
1964
|
+
* meaning within HTTP/2, the argument will have no effect and a process warning
|
|
1965
|
+
* will be emitted.
|
|
1966
|
+
*
|
|
1967
|
+
* ```js
|
|
1968
|
+
* const body = 'hello world';
|
|
1969
|
+
* response.writeHead(200, {
|
|
1970
|
+
* 'Content-Length': Buffer.byteLength(body),
|
|
1971
|
+
* 'Content-Type': 'text/plain; charset=utf-8',
|
|
1972
|
+
* });
|
|
1973
|
+
* ```
|
|
1974
|
+
*
|
|
1975
|
+
* `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a
|
|
1976
|
+
* given encoding. On outbound messages, Node.js does not check if Content-Length
|
|
1977
|
+
* and the length of the body being transmitted are equal or not. However, when
|
|
1978
|
+
* receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size.
|
|
1979
|
+
*
|
|
1980
|
+
* This method may be called at most one time on a message before `response.end()` is called.
|
|
1981
|
+
*
|
|
1982
|
+
* If `response.write()` or `response.end()` are called before calling
|
|
1983
|
+
* this, the implicit/mutable headers will be calculated and call this function.
|
|
1984
|
+
*
|
|
1985
|
+
* When headers have been set with `response.setHeader()`, they will be merged
|
|
1986
|
+
* with any headers passed to `response.writeHead()`, with the headers passed
|
|
1987
|
+
* to `response.writeHead()` given precedence.
|
|
1988
|
+
*
|
|
1989
|
+
* ```js
|
|
1990
|
+
* // Returns content-type = text/plain
|
|
1991
|
+
* const server = http2.createServer((req, res) => {
|
|
1992
|
+
* res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
1993
|
+
* res.setHeader('X-Foo', 'bar');
|
|
1994
|
+
* res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
1995
|
+
* res.end('ok');
|
|
1996
|
+
* });
|
|
1997
|
+
* ```
|
|
1998
|
+
*
|
|
1999
|
+
* Attempting to set a header field name or value that contains invalid characters
|
|
2000
|
+
* will result in a `TypeError` being thrown.
|
|
2001
|
+
* @since v8.4.0
|
|
2002
|
+
*/
|
|
907
2003
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
|
908
2004
|
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
|
|
2005
|
+
/**
|
|
2006
|
+
* Call `http2stream.pushStream()` with the given headers, and wrap the
|
|
2007
|
+
* given `Http2Stream` on a newly created `Http2ServerResponse` as the callback
|
|
2008
|
+
* parameter if successful. When `Http2ServerRequest` is closed, the callback is
|
|
2009
|
+
* called with an error `ERR_HTTP2_INVALID_STREAM`.
|
|
2010
|
+
* @since v8.4.0
|
|
2011
|
+
* @param headers An object describing the headers
|
|
2012
|
+
* @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of
|
|
2013
|
+
* `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method
|
|
2014
|
+
*/
|
|
909
2015
|
createPushResponse(
|
|
910
2016
|
headers: OutgoingHttpHeaders,
|
|
911
2017
|
callback: (err: Error | null, res: Http2ServerResponse) => void,
|
|
912
2018
|
): void;
|
|
913
|
-
|
|
914
2019
|
addListener(event: "close", listener: () => void): this;
|
|
915
2020
|
addListener(event: "drain", listener: () => void): this;
|
|
916
2021
|
addListener(event: "error", listener: (error: Error) => void): this;
|
|
@@ -918,7 +2023,6 @@ declare module "http2" {
|
|
|
918
2023
|
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
919
2024
|
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
920
2025
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
921
|
-
|
|
922
2026
|
emit(event: "close"): boolean;
|
|
923
2027
|
emit(event: "drain"): boolean;
|
|
924
2028
|
emit(event: "error", error: Error): boolean;
|
|
@@ -926,7 +2030,6 @@ declare module "http2" {
|
|
|
926
2030
|
emit(event: "pipe", src: stream.Readable): boolean;
|
|
927
2031
|
emit(event: "unpipe", src: stream.Readable): boolean;
|
|
928
2032
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
929
|
-
|
|
930
2033
|
on(event: "close", listener: () => void): this;
|
|
931
2034
|
on(event: "drain", listener: () => void): this;
|
|
932
2035
|
on(event: "error", listener: (error: Error) => void): this;
|
|
@@ -934,7 +2037,6 @@ declare module "http2" {
|
|
|
934
2037
|
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
935
2038
|
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
936
2039
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
937
|
-
|
|
938
2040
|
once(event: "close", listener: () => void): this;
|
|
939
2041
|
once(event: "drain", listener: () => void): this;
|
|
940
2042
|
once(event: "error", listener: (error: Error) => void): this;
|
|
@@ -942,7 +2044,6 @@ declare module "http2" {
|
|
|
942
2044
|
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
943
2045
|
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
944
2046
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
945
|
-
|
|
946
2047
|
prependListener(event: "close", listener: () => void): this;
|
|
947
2048
|
prependListener(event: "drain", listener: () => void): this;
|
|
948
2049
|
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
@@ -950,7 +2051,6 @@ declare module "http2" {
|
|
|
950
2051
|
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
951
2052
|
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
952
2053
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
953
|
-
|
|
954
2054
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
955
2055
|
prependOnceListener(event: "drain", listener: () => void): this;
|
|
956
2056
|
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
@@ -959,9 +2059,6 @@ declare module "http2" {
|
|
|
959
2059
|
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
960
2060
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
961
2061
|
}
|
|
962
|
-
|
|
963
|
-
// Public API
|
|
964
|
-
|
|
965
2062
|
export namespace constants {
|
|
966
2063
|
const NGHTTP2_SESSION_SERVER: number;
|
|
967
2064
|
const NGHTTP2_SESSION_CLIENT: number;
|
|
@@ -1020,7 +2117,13 @@ declare module "http2" {
|
|
|
1020
2117
|
const HTTP2_HEADER_ACCEPT_LANGUAGE: string;
|
|
1021
2118
|
const HTTP2_HEADER_ACCEPT_RANGES: string;
|
|
1022
2119
|
const HTTP2_HEADER_ACCEPT: string;
|
|
2120
|
+
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: string;
|
|
2121
|
+
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: string;
|
|
2122
|
+
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: string;
|
|
1023
2123
|
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string;
|
|
2124
|
+
const HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: string;
|
|
2125
|
+
const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: string;
|
|
2126
|
+
const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: string;
|
|
1024
2127
|
const HTTP2_HEADER_AGE: string;
|
|
1025
2128
|
const HTTP2_HEADER_ALLOW: string;
|
|
1026
2129
|
const HTTP2_HEADER_AUTHORIZATION: string;
|
|
@@ -1172,11 +2275,69 @@ declare module "http2" {
|
|
|
1172
2275
|
const HTTP_STATUS_NOT_EXTENDED: number;
|
|
1173
2276
|
const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number;
|
|
1174
2277
|
}
|
|
1175
|
-
|
|
2278
|
+
/**
|
|
2279
|
+
* This symbol can be set as a property on the HTTP/2 headers object with
|
|
2280
|
+
* an array value in order to provide a list of headers considered sensitive.
|
|
2281
|
+
*/
|
|
2282
|
+
export const sensitiveHeaders: symbol;
|
|
2283
|
+
/**
|
|
2284
|
+
* Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
|
|
2285
|
+
* so instances returned may be safely modified for use.
|
|
2286
|
+
* @since v8.4.0
|
|
2287
|
+
*/
|
|
1176
2288
|
export function getDefaultSettings(): Settings;
|
|
2289
|
+
/**
|
|
2290
|
+
* Returns a `Buffer` instance containing serialized representation of the given
|
|
2291
|
+
* HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended
|
|
2292
|
+
* for use with the `HTTP2-Settings` header field.
|
|
2293
|
+
*
|
|
2294
|
+
* ```js
|
|
2295
|
+
* const http2 = require('node:http2');
|
|
2296
|
+
*
|
|
2297
|
+
* const packed = http2.getPackedSettings({ enablePush: false });
|
|
2298
|
+
*
|
|
2299
|
+
* console.log(packed.toString('base64'));
|
|
2300
|
+
* // Prints: AAIAAAAA
|
|
2301
|
+
* ```
|
|
2302
|
+
* @since v8.4.0
|
|
2303
|
+
*/
|
|
1177
2304
|
export function getPackedSettings(settings: Settings): Buffer;
|
|
2305
|
+
/**
|
|
2306
|
+
* Returns a `HTTP/2 Settings Object` containing the deserialized settings from
|
|
2307
|
+
* the given `Buffer` as generated by `http2.getPackedSettings()`.
|
|
2308
|
+
* @since v8.4.0
|
|
2309
|
+
* @param buf The packed settings.
|
|
2310
|
+
*/
|
|
1178
2311
|
export function getUnpackedSettings(buf: Uint8Array): Settings;
|
|
1179
|
-
|
|
2312
|
+
/**
|
|
2313
|
+
* Returns a `net.Server` instance that creates and manages `Http2Session` instances.
|
|
2314
|
+
*
|
|
2315
|
+
* Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when
|
|
2316
|
+
* communicating
|
|
2317
|
+
* with browser clients.
|
|
2318
|
+
*
|
|
2319
|
+
* ```js
|
|
2320
|
+
* const http2 = require('node:http2');
|
|
2321
|
+
*
|
|
2322
|
+
* // Create an unencrypted HTTP/2 server.
|
|
2323
|
+
* // Since there are no browsers known that support
|
|
2324
|
+
* // unencrypted HTTP/2, the use of `http2.createSecureServer()`
|
|
2325
|
+
* // is necessary when communicating with browser clients.
|
|
2326
|
+
* const server = http2.createServer();
|
|
2327
|
+
*
|
|
2328
|
+
* server.on('stream', (stream, headers) => {
|
|
2329
|
+
* stream.respond({
|
|
2330
|
+
* 'content-type': 'text/html; charset=utf-8',
|
|
2331
|
+
* ':status': 200,
|
|
2332
|
+
* });
|
|
2333
|
+
* stream.end('<h1>Hello World</h1>');
|
|
2334
|
+
* });
|
|
2335
|
+
*
|
|
2336
|
+
* server.listen(8000);
|
|
2337
|
+
* ```
|
|
2338
|
+
* @since v8.4.0
|
|
2339
|
+
* @param onRequestHandler See `Compatibility API`
|
|
2340
|
+
*/
|
|
1180
2341
|
export function createServer(
|
|
1181
2342
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
1182
2343
|
): Http2Server;
|
|
@@ -1184,7 +2345,34 @@ declare module "http2" {
|
|
|
1184
2345
|
options: ServerOptions,
|
|
1185
2346
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
1186
2347
|
): Http2Server;
|
|
1187
|
-
|
|
2348
|
+
/**
|
|
2349
|
+
* Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
|
|
2350
|
+
*
|
|
2351
|
+
* ```js
|
|
2352
|
+
* const http2 = require('node:http2');
|
|
2353
|
+
* const fs = require('node:fs');
|
|
2354
|
+
*
|
|
2355
|
+
* const options = {
|
|
2356
|
+
* key: fs.readFileSync('server-key.pem'),
|
|
2357
|
+
* cert: fs.readFileSync('server-cert.pem'),
|
|
2358
|
+
* };
|
|
2359
|
+
*
|
|
2360
|
+
* // Create a secure HTTP/2 server
|
|
2361
|
+
* const server = http2.createSecureServer(options);
|
|
2362
|
+
*
|
|
2363
|
+
* server.on('stream', (stream, headers) => {
|
|
2364
|
+
* stream.respond({
|
|
2365
|
+
* 'content-type': 'text/html; charset=utf-8',
|
|
2366
|
+
* ':status': 200,
|
|
2367
|
+
* });
|
|
2368
|
+
* stream.end('<h1>Hello World</h1>');
|
|
2369
|
+
* });
|
|
2370
|
+
*
|
|
2371
|
+
* server.listen(8443);
|
|
2372
|
+
* ```
|
|
2373
|
+
* @since v8.4.0
|
|
2374
|
+
* @param onRequestHandler See `Compatibility API`
|
|
2375
|
+
*/
|
|
1188
2376
|
export function createSecureServer(
|
|
1189
2377
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
1190
2378
|
): Http2SecureServer;
|
|
@@ -1192,7 +2380,22 @@ declare module "http2" {
|
|
|
1192
2380
|
options: SecureServerOptions,
|
|
1193
2381
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
|
1194
2382
|
): Http2SecureServer;
|
|
1195
|
-
|
|
2383
|
+
/**
|
|
2384
|
+
* Returns a `ClientHttp2Session` instance.
|
|
2385
|
+
*
|
|
2386
|
+
* ```js
|
|
2387
|
+
* const http2 = require('node:http2');
|
|
2388
|
+
* const client = http2.connect('https://localhost:1234');
|
|
2389
|
+
*
|
|
2390
|
+
* // Use the client
|
|
2391
|
+
*
|
|
2392
|
+
* client.close();
|
|
2393
|
+
* ```
|
|
2394
|
+
* @since v8.4.0
|
|
2395
|
+
* @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port
|
|
2396
|
+
* is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.
|
|
2397
|
+
* @param listener Will be registered as a one-time listener of the {@link 'connect'} event.
|
|
2398
|
+
*/
|
|
1196
2399
|
export function connect(
|
|
1197
2400
|
authority: string | url.URL,
|
|
1198
2401
|
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
@@ -1202,6 +2405,13 @@ declare module "http2" {
|
|
|
1202
2405
|
options?: ClientSessionOptions | SecureClientSessionOptions,
|
|
1203
2406
|
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
1204
2407
|
): ClientHttp2Session;
|
|
2408
|
+
/**
|
|
2409
|
+
* Create an HTTP/2 server session from an existing socket.
|
|
2410
|
+
* @param socket A Duplex Stream
|
|
2411
|
+
* @param options Any `{@link createServer}` options can be provided.
|
|
2412
|
+
* @since v20.12.0
|
|
2413
|
+
*/
|
|
2414
|
+
export function performServerHandshake(socket: stream.Duplex, options?: ServerOptions): ServerHttp2Session;
|
|
1205
2415
|
}
|
|
1206
2416
|
declare module "node:http2" {
|
|
1207
2417
|
export * from "http2";
|