githrun

A CLI tool to run Python scrip...
Log | Files | Refs | README | LICENSE

http2.d.ts (122415B)


      1 /**
      2  * The `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  * import http2 from 'node:http2';
      7  * ```
      8  * @since v8.4.0
      9  * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/http2.js)
     10  */
     11 declare module "http2" {
     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";
     18     import {
     19         IncomingHttpHeaders as Http1IncomingHttpHeaders,
     20         IncomingMessage,
     21         OutgoingHttpHeaders,
     22         ServerResponse,
     23     } from "node:http";
     24     export { OutgoingHttpHeaders } from "node:http";
     25     export interface IncomingHttpStatusHeader {
     26         ":status"?: number | undefined;
     27     }
     28     export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
     29         ":path"?: string | undefined;
     30         ":method"?: string | undefined;
     31         ":authority"?: string | undefined;
     32         ":scheme"?: string | undefined;
     33     }
     34     // Http2Stream
     35     export interface StreamPriorityOptions {
     36         exclusive?: boolean | undefined;
     37         parent?: number | undefined;
     38         weight?: number | undefined;
     39         silent?: boolean | undefined;
     40     }
     41     export interface StreamState {
     42         localWindowSize?: number | undefined;
     43         state?: number | undefined;
     44         localClose?: number | undefined;
     45         remoteClose?: number | undefined;
     46         sumDependencyWeight?: number | undefined;
     47         weight?: number | undefined;
     48     }
     49     export interface ServerStreamResponseOptions {
     50         endStream?: boolean | undefined;
     51         waitForTrailers?: boolean | undefined;
     52     }
     53     export interface StatOptions {
     54         offset: number;
     55         length: number;
     56     }
     57     export interface ServerStreamFileResponseOptions {
     58         // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
     59         statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean;
     60         waitForTrailers?: boolean | undefined;
     61         offset?: number | undefined;
     62         length?: number | undefined;
     63     }
     64     export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
     65         onError?(err: NodeJS.ErrnoException): void;
     66     }
     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          */
     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          */
     79         readonly bufferSize: number;
     80         /**
     81          * Set to `true` if the `Http2Stream` instance has been closed.
     82          * @since v9.4.0
     83          */
     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          */
     90         readonly destroyed: boolean;
     91         /**
     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
     96          */
     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          */
    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          */
    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          */
    115         readonly rstCode: number;
    116         /**
    117          * An object containing the outbound headers sent for this `Http2Stream`.
    118          * @since v9.5.0
    119          */
    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          */
    126         readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined;
    127         /**
    128          * An object containing the outbound trailers sent for this `HttpStream`.
    129          * @since v9.5.0
    130          */
    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          */
    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          */
    144         readonly state: StreamState;
    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          */
    152         close(code?: number, callback?: () => void): void;
    153         /**
    154          * Updates the priority for this `Http2Stream` instance.
    155          * @since v8.4.0
    156          */
    157         priority(options: StreamPriorityOptions): void;
    158         /**
    159          * ```js
    160          * import http2 from '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          */
    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          * import http2 from '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          */
    195         sendTrailers(headers: OutgoingHttpHeaders): void;
    196         addListener(event: "aborted", listener: () => void): this;
    197         addListener(event: "close", listener: () => void): this;
    198         addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
    199         addListener(event: "drain", listener: () => void): this;
    200         addListener(event: "end", listener: () => void): this;
    201         addListener(event: "error", listener: (err: Error) => void): this;
    202         addListener(event: "finish", listener: () => void): this;
    203         addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
    204         addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
    205         addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
    206         addListener(event: "streamClosed", listener: (code: number) => void): this;
    207         addListener(event: "timeout", listener: () => void): this;
    208         addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
    209         addListener(event: "wantTrailers", listener: () => void): this;
    210         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
    211         emit(event: "aborted"): boolean;
    212         emit(event: "close"): boolean;
    213         emit(event: "data", chunk: Buffer | string): boolean;
    214         emit(event: "drain"): boolean;
    215         emit(event: "end"): boolean;
    216         emit(event: "error", err: Error): boolean;
    217         emit(event: "finish"): boolean;
    218         emit(event: "frameError", frameType: number, errorCode: number): boolean;
    219         emit(event: "pipe", src: stream.Readable): boolean;
    220         emit(event: "unpipe", src: stream.Readable): boolean;
    221         emit(event: "streamClosed", code: number): boolean;
    222         emit(event: "timeout"): boolean;
    223         emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean;
    224         emit(event: "wantTrailers"): boolean;
    225         emit(event: string | symbol, ...args: any[]): boolean;
    226         on(event: "aborted", listener: () => void): this;
    227         on(event: "close", listener: () => void): this;
    228         on(event: "data", listener: (chunk: Buffer | string) => void): this;
    229         on(event: "drain", listener: () => void): this;
    230         on(event: "end", listener: () => void): this;
    231         on(event: "error", listener: (err: Error) => void): this;
    232         on(event: "finish", listener: () => void): this;
    233         on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
    234         on(event: "pipe", listener: (src: stream.Readable) => void): this;
    235         on(event: "unpipe", listener: (src: stream.Readable) => void): this;
    236         on(event: "streamClosed", listener: (code: number) => void): this;
    237         on(event: "timeout", listener: () => void): this;
    238         on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
    239         on(event: "wantTrailers", listener: () => void): this;
    240         on(event: string | symbol, listener: (...args: any[]) => void): this;
    241         once(event: "aborted", listener: () => void): this;
    242         once(event: "close", listener: () => void): this;
    243         once(event: "data", listener: (chunk: Buffer | string) => void): this;
    244         once(event: "drain", listener: () => void): this;
    245         once(event: "end", listener: () => void): this;
    246         once(event: "error", listener: (err: Error) => void): this;
    247         once(event: "finish", listener: () => void): this;
    248         once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
    249         once(event: "pipe", listener: (src: stream.Readable) => void): this;
    250         once(event: "unpipe", listener: (src: stream.Readable) => void): this;
    251         once(event: "streamClosed", listener: (code: number) => void): this;
    252         once(event: "timeout", listener: () => void): this;
    253         once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
    254         once(event: "wantTrailers", listener: () => void): this;
    255         once(event: string | symbol, listener: (...args: any[]) => void): this;
    256         prependListener(event: "aborted", listener: () => void): this;
    257         prependListener(event: "close", listener: () => void): this;
    258         prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
    259         prependListener(event: "drain", listener: () => void): this;
    260         prependListener(event: "end", listener: () => void): this;
    261         prependListener(event: "error", listener: (err: Error) => void): this;
    262         prependListener(event: "finish", listener: () => void): this;
    263         prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
    264         prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
    265         prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
    266         prependListener(event: "streamClosed", listener: (code: number) => void): this;
    267         prependListener(event: "timeout", listener: () => void): this;
    268         prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
    269         prependListener(event: "wantTrailers", listener: () => void): this;
    270         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
    271         prependOnceListener(event: "aborted", listener: () => void): this;
    272         prependOnceListener(event: "close", listener: () => void): this;
    273         prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
    274         prependOnceListener(event: "drain", listener: () => void): this;
    275         prependOnceListener(event: "end", listener: () => void): this;
    276         prependOnceListener(event: "error", listener: (err: Error) => void): this;
    277         prependOnceListener(event: "finish", listener: () => void): this;
    278         prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
    279         prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
    280         prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
    281         prependOnceListener(event: "streamClosed", listener: (code: number) => void): this;
    282         prependOnceListener(event: "timeout", listener: () => void): this;
    283         prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
    284         prependOnceListener(event: "wantTrailers", listener: () => void): this;
    285         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
    286     }
    287     export interface ClientHttp2Stream extends Http2Stream {
    288         addListener(event: "continue", listener: () => {}): this;
    289         addListener(
    290             event: "headers",
    291             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    292         ): this;
    293         addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
    294         addListener(
    295             event: "response",
    296             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    297         ): this;
    298         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
    299         emit(event: "continue"): boolean;
    300         emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
    301         emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
    302         emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
    303         emit(event: string | symbol, ...args: any[]): boolean;
    304         on(event: "continue", listener: () => {}): this;
    305         on(
    306             event: "headers",
    307             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    308         ): this;
    309         on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
    310         on(
    311             event: "response",
    312             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    313         ): this;
    314         on(event: string | symbol, listener: (...args: any[]) => void): this;
    315         once(event: "continue", listener: () => {}): this;
    316         once(
    317             event: "headers",
    318             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    319         ): this;
    320         once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
    321         once(
    322             event: "response",
    323             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    324         ): this;
    325         once(event: string | symbol, listener: (...args: any[]) => void): this;
    326         prependListener(event: "continue", listener: () => {}): this;
    327         prependListener(
    328             event: "headers",
    329             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    330         ): this;
    331         prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
    332         prependListener(
    333             event: "response",
    334             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    335         ): this;
    336         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
    337         prependOnceListener(event: "continue", listener: () => {}): this;
    338         prependOnceListener(
    339             event: "headers",
    340             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    341         ): this;
    342         prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
    343         prependOnceListener(
    344             event: "response",
    345             listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
    346         ): this;
    347         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
    348     }
    349     export interface ServerHttp2Stream extends Http2Stream {
    350         /**
    351          * True if headers were sent, false otherwise (read-only).
    352          * @since v8.4.0
    353          */
    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          */
    361         readonly pushAllowed: boolean;
    362         /**
    363          * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer.
    364          * @since v8.4.0
    365          */
    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          * import http2 from '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          */
    392         pushStream(
    393             headers: OutgoingHttpHeaders,
    394             callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
    395         ): void;
    396         pushStream(
    397             headers: OutgoingHttpHeaders,
    398             options?: StreamPriorityOptions,
    399             callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
    400         ): void;
    401         /**
    402          * ```js
    403          * import http2 from '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
    412          * will be emitted immediately after queuing the last chunk of payload data to be sent.
    413          * The `http2stream.sendTrailers()` method can then be used to send 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          * import http2 from '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          */
    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          * import http2 from 'node:http2';
    443          * import fs from '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
    463          * perform an `fs.fstat()` call to 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()`
    482          * or `http2stream.close()` to close the `Http2Stream`.
    483          *
    484          * ```js
    485          * import http2 from 'node:http2';
    486          * import fs from 'node:fs';
    487          *
    488          * const server = http2.createServer();
    489          * server.on('stream', (stream) => {
    490          *   const fd = fs.openSync('/some/file', 'r');
    491          *
    492          *   const stat = fs.fstatSync(fd);
    493          *   const headers = {
    494          *     'content-length': stat.size,
    495          *     'last-modified': stat.mtime.toUTCString(),
    496          *     'content-type': 'text/plain; charset=utf-8',
    497          *   };
    498          *   stream.respondWithFD(fd, headers, { waitForTrailers: true });
    499          *   stream.on('wantTrailers', () => {
    500          *     stream.sendTrailers({ ABC: 'some value to send' });
    501          *   });
    502          *
    503          *   stream.on('close', () => fs.closeSync(fd));
    504          * });
    505          * ```
    506          * @since v8.4.0
    507          * @param fd A readable file descriptor.
    508          */
    509         respondWithFD(
    510             fd: number | fs.promises.FileHandle,
    511             headers?: OutgoingHttpHeaders,
    512             options?: ServerStreamFileResponseOptions,
    513         ): void;
    514         /**
    515          * Sends a regular file as the response. The `path` must specify a regular file
    516          * or an `'error'` event will be emitted on the `Http2Stream` object.
    517          *
    518          * When used, the `Http2Stream` object's `Duplex` interface will be closed
    519          * automatically.
    520          *
    521          * The optional `options.statCheck` function may be specified to give user code
    522          * an opportunity to set additional content headers based on the `fs.Stat` details
    523          * of the given file:
    524          *
    525          * If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an
    526          * `RST_STREAM` frame using the standard `INTERNAL_ERROR` code.
    527          * If the `onError` callback is defined, then it will be called. Otherwise, the stream will be destroyed.
    528          *
    529          * Example using a file path:
    530          *
    531          * ```js
    532          * import http2 from 'node:http2';
    533          * const server = http2.createServer();
    534          * server.on('stream', (stream) => {
    535          *   function statCheck(stat, headers) {
    536          *     headers['last-modified'] = stat.mtime.toUTCString();
    537          *   }
    538          *
    539          *   function onError(err) {
    540          *     // stream.respond() can throw if the stream has been destroyed by
    541          *     // the other side.
    542          *     try {
    543          *       if (err.code === 'ENOENT') {
    544          *         stream.respond({ ':status': 404 });
    545          *       } else {
    546          *         stream.respond({ ':status': 500 });
    547          *       }
    548          *     } catch (err) {
    549          *       // Perform actual error handling.
    550          *       console.error(err);
    551          *     }
    552          *     stream.end();
    553          *   }
    554          *
    555          *   stream.respondWithFile('/some/file',
    556          *                          { 'content-type': 'text/plain; charset=utf-8' },
    557          *                          { statCheck, onError });
    558          * });
    559          * ```
    560          *
    561          * The `options.statCheck` function may also be used to cancel the send operation
    562          * by returning `false`. For instance, a conditional request may check the stat
    563          * results to determine if the file has been modified to return an appropriate `304` response:
    564          *
    565          * ```js
    566          * import http2 from 'node:http2';
    567          * const server = http2.createServer();
    568          * server.on('stream', (stream) => {
    569          *   function statCheck(stat, headers) {
    570          *     // Check the stat here...
    571          *     stream.respond({ ':status': 304 });
    572          *     return false; // Cancel the send operation
    573          *   }
    574          *   stream.respondWithFile('/some/file',
    575          *                          { 'content-type': 'text/plain; charset=utf-8' },
    576          *                          { statCheck });
    577          * });
    578          * ```
    579          *
    580          * The `content-length` header field will be automatically set.
    581          *
    582          * The `offset` and `length` options may be used to limit the response to a
    583          * specific range subset. This can be used, for instance, to support HTTP Range
    584          * requests.
    585          *
    586          * The `options.onError` function may also be used to handle all the errors
    587          * that could happen before the delivery of the file is initiated. The
    588          * default behavior is to destroy the stream.
    589          *
    590          * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
    591          * will be emitted immediately after queuing the last chunk of payload data to be
    592          * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing
    593          * header fields to the peer.
    594          *
    595          * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
    596          * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
    597          *
    598          * ```js
    599          * import http2 from 'node:http2';
    600          * const server = http2.createServer();
    601          * server.on('stream', (stream) => {
    602          *   stream.respondWithFile('/some/file',
    603          *                          { 'content-type': 'text/plain; charset=utf-8' },
    604          *                          { waitForTrailers: true });
    605          *   stream.on('wantTrailers', () => {
    606          *     stream.sendTrailers({ ABC: 'some value to send' });
    607          *   });
    608          * });
    609          * ```
    610          * @since v8.4.0
    611          */
    612         respondWithFile(
    613             path: string,
    614             headers?: OutgoingHttpHeaders,
    615             options?: ServerStreamFileResponseOptionsWithError,
    616         ): void;
    617     }
    618     // Http2Session
    619     export interface Settings {
    620         headerTableSize?: number | undefined;
    621         enablePush?: boolean | undefined;
    622         initialWindowSize?: number | undefined;
    623         maxFrameSize?: number | undefined;
    624         maxConcurrentStreams?: number | undefined;
    625         maxHeaderListSize?: number | undefined;
    626         enableConnectProtocol?: boolean | undefined;
    627     }
    628     export interface ClientSessionRequestOptions {
    629         endStream?: boolean | undefined;
    630         exclusive?: boolean | undefined;
    631         parent?: number | undefined;
    632         weight?: number | undefined;
    633         waitForTrailers?: boolean | undefined;
    634         signal?: AbortSignal | undefined;
    635     }
    636     export interface SessionState {
    637         effectiveLocalWindowSize?: number | undefined;
    638         effectiveRecvDataLength?: number | undefined;
    639         nextStreamID?: number | undefined;
    640         localWindowSize?: number | undefined;
    641         lastProcStreamID?: number | undefined;
    642         remoteWindowSize?: number | undefined;
    643         outboundQueueSize?: number | undefined;
    644         deflateDynamicTableSize?: number | undefined;
    645         inflateDynamicTableSize?: number | undefined;
    646     }
    647     export interface Http2Session extends EventEmitter {
    648         /**
    649          * Value will be `undefined` if the `Http2Session` is not yet connected to a
    650          * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or
    651          * will return the value of the connected `TLSSocket`'s own `alpnProtocol` property.
    652          * @since v9.4.0
    653          */
    654         readonly alpnProtocol?: string | undefined;
    655         /**
    656          * Will be `true` if this `Http2Session` instance has been closed, otherwise `false`.
    657          * @since v9.4.0
    658          */
    659         readonly closed: boolean;
    660         /**
    661          * Will be `true` if this `Http2Session` instance is still connecting, will be set
    662          * to `false` before emitting `connect` event and/or calling the `http2.connect` callback.
    663          * @since v10.0.0
    664          */
    665         readonly connecting: boolean;
    666         /**
    667          * Will be `true` if this `Http2Session` instance has been destroyed and must no
    668          * longer be used, otherwise `false`.
    669          * @since v8.4.0
    670          */
    671         readonly destroyed: boolean;
    672         /**
    673          * Value is `undefined` if the `Http2Session` session socket has not yet been
    674          * connected, `true` if the `Http2Session` is connected with a `TLSSocket`,
    675          * and `false` if the `Http2Session` is connected to any other kind of socket
    676          * or stream.
    677          * @since v9.4.0
    678          */
    679         readonly encrypted?: boolean | undefined;
    680         /**
    681          * A prototype-less object describing the current local settings of this `Http2Session`.
    682          * The local settings are local to _this_`Http2Session` instance.
    683          * @since v8.4.0
    684          */
    685         readonly localSettings: Settings;
    686         /**
    687          * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property
    688          * will return an `Array` of origins for which the `Http2Session` may be
    689          * considered authoritative.
    690          *
    691          * The `originSet` property is only available when using a secure TLS connection.
    692          * @since v9.4.0
    693          */
    694         readonly originSet?: string[] | undefined;
    695         /**
    696          * Indicates whether the `Http2Session` is currently waiting for acknowledgment of
    697          * a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method.
    698          * Will be `false` once all sent `SETTINGS` frames have been acknowledged.
    699          * @since v8.4.0
    700          */
    701         readonly pendingSettingsAck: boolean;
    702         /**
    703          * A prototype-less object describing the current remote settings of this`Http2Session`.
    704          * The remote settings are set by the _connected_ HTTP/2 peer.
    705          * @since v8.4.0
    706          */
    707         readonly remoteSettings: Settings;
    708         /**
    709          * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
    710          * limits available methods to ones safe to use with HTTP/2.
    711          *
    712          * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw
    713          * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information.
    714          *
    715          * `setTimeout` method will be called on this `Http2Session`.
    716          *
    717          * All other interactions will be routed directly to the socket.
    718          * @since v8.4.0
    719          */
    720         readonly socket: net.Socket | tls.TLSSocket;
    721         /**
    722          * Provides miscellaneous information about the current state of the`Http2Session`.
    723          *
    724          * An object describing the current status of this `Http2Session`.
    725          * @since v8.4.0
    726          */
    727         readonly state: SessionState;
    728         /**
    729          * The `http2session.type` will be equal to `http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a
    730          * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a
    731          * client.
    732          * @since v8.4.0
    733          */
    734         readonly type: number;
    735         /**
    736          * Gracefully closes the `Http2Session`, allowing any existing streams to
    737          * complete on their own and preventing new `Http2Stream` instances from being
    738          * created. Once closed, `http2session.destroy()`_might_ be called if there
    739          * are no open `Http2Stream` instances.
    740          *
    741          * If specified, the `callback` function is registered as a handler for the`'close'` event.
    742          * @since v9.4.0
    743          */
    744         close(callback?: () => void): void;
    745         /**
    746          * Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`.
    747          *
    748          * 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.
    749          *
    750          * If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed.
    751          * @since v8.4.0
    752          * @param error An `Error` object if the `Http2Session` is being destroyed due to an error.
    753          * @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`.
    754          */
    755         destroy(error?: Error, code?: number): void;
    756         /**
    757          * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`.
    758          * @since v9.4.0
    759          * @param code An HTTP/2 error code
    760          * @param lastStreamID The numeric ID of the last processed `Http2Stream`
    761          * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame.
    762          */
    763         goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void;
    764         /**
    765          * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must
    766          * be provided. The method will return `true` if the `PING` was sent, `false` otherwise.
    767          *
    768          * The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10.
    769          *
    770          * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and
    771          * returned with the ping acknowledgment.
    772          *
    773          * The callback will be invoked with three arguments: an error argument that will
    774          * be `null` if the `PING` was successfully acknowledged, a `duration` argument
    775          * that reports the number of milliseconds elapsed since the ping was sent and the
    776          * acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload.
    777          *
    778          * ```js
    779          * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => {
    780          *   if (!err) {
    781          *     console.log(`Ping acknowledged in ${duration} milliseconds`);
    782          *     console.log(`With payload '${payload.toString()}'`);
    783          *   }
    784          * });
    785          * ```
    786          *
    787          * If the `payload` argument is not specified, the default payload will be the
    788          * 64-bit timestamp (little endian) marking the start of the `PING` duration.
    789          * @since v8.9.3
    790          * @param payload Optional ping payload.
    791          */
    792         ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
    793         ping(
    794             payload: NodeJS.ArrayBufferView,
    795             callback: (err: Error | null, duration: number, payload: Buffer) => void,
    796         ): boolean;
    797         /**
    798          * Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`.
    799          * @since v9.4.0
    800          */
    801         ref(): void;
    802         /**
    803          * Sets the local endpoint's window size.
    804          * The `windowSize` is the total window size to set, not
    805          * the delta.
    806          *
    807          * ```js
    808          * import http2 from 'node:http2';
    809          *
    810          * const server = http2.createServer();
    811          * const expectedWindowSize = 2 ** 20;
    812          * server.on('connect', (session) => {
    813          *
    814          *   // Set local window size to be 2 ** 20
    815          *   session.setLocalWindowSize(expectedWindowSize);
    816          * });
    817          * ```
    818          * @since v15.3.0, v14.18.0
    819          */
    820         setLocalWindowSize(windowSize: number): void;
    821         /**
    822          * Used to set a callback function that is called when there is no activity on
    823          * the `Http2Session` after `msecs` milliseconds. The given `callback` is
    824          * registered as a listener on the `'timeout'` event.
    825          * @since v8.4.0
    826          */
    827         setTimeout(msecs: number, callback?: () => void): void;
    828         /**
    829          * Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer.
    830          *
    831          * Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new
    832          * settings.
    833          *
    834          * The new settings will not become effective until the `SETTINGS` acknowledgment
    835          * is received and the `'localSettings'` event is emitted. It is possible to send
    836          * multiple `SETTINGS` frames while acknowledgment is still pending.
    837          * @since v8.4.0
    838          * @param callback Callback that is called once the session is connected or right away if the session is already connected.
    839          */
    840         settings(
    841             settings: Settings,
    842             callback?: (err: Error | null, settings: Settings, duration: number) => void,
    843         ): void;
    844         /**
    845          * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`.
    846          * @since v9.4.0
    847          */
    848         unref(): void;
    849         addListener(event: "close", listener: () => void): this;
    850         addListener(event: "error", listener: (err: Error) => void): this;
    851         addListener(
    852             event: "frameError",
    853             listener: (frameType: number, errorCode: number, streamID: number) => void,
    854         ): this;
    855         addListener(
    856             event: "goaway",
    857             listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void,
    858         ): this;
    859         addListener(event: "localSettings", listener: (settings: Settings) => void): this;
    860         addListener(event: "ping", listener: () => void): this;
    861         addListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
    862         addListener(event: "timeout", listener: () => void): this;
    863         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
    864         emit(event: "close"): boolean;
    865         emit(event: "error", err: Error): boolean;
    866         emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
    867         emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: Buffer): boolean;
    868         emit(event: "localSettings", settings: Settings): boolean;
    869         emit(event: "ping"): boolean;
    870         emit(event: "remoteSettings", settings: Settings): boolean;
    871         emit(event: "timeout"): boolean;
    872         emit(event: string | symbol, ...args: any[]): boolean;
    873         on(event: "close", listener: () => void): this;
    874         on(event: "error", listener: (err: Error) => void): this;
    875         on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
    876         on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this;
    877         on(event: "localSettings", listener: (settings: Settings) => void): this;
    878         on(event: "ping", listener: () => void): this;
    879         on(event: "remoteSettings", listener: (settings: Settings) => void): this;
    880         on(event: "timeout", listener: () => void): this;
    881         on(event: string | symbol, listener: (...args: any[]) => void): this;
    882         once(event: "close", listener: () => void): this;
    883         once(event: "error", listener: (err: Error) => void): this;
    884         once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
    885         once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this;
    886         once(event: "localSettings", listener: (settings: Settings) => void): this;
    887         once(event: "ping", listener: () => void): this;
    888         once(event: "remoteSettings", listener: (settings: Settings) => void): this;
    889         once(event: "timeout", listener: () => void): this;
    890         once(event: string | symbol, listener: (...args: any[]) => void): this;
    891         prependListener(event: "close", listener: () => void): this;
    892         prependListener(event: "error", listener: (err: Error) => void): this;
    893         prependListener(
    894             event: "frameError",
    895             listener: (frameType: number, errorCode: number, streamID: number) => void,
    896         ): this;
    897         prependListener(
    898             event: "goaway",
    899             listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void,
    900         ): this;
    901         prependListener(event: "localSettings", listener: (settings: Settings) => void): this;
    902         prependListener(event: "ping", listener: () => void): this;
    903         prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
    904         prependListener(event: "timeout", listener: () => void): this;
    905         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
    906         prependOnceListener(event: "close", listener: () => void): this;
    907         prependOnceListener(event: "error", listener: (err: Error) => void): this;
    908         prependOnceListener(
    909             event: "frameError",
    910             listener: (frameType: number, errorCode: number, streamID: number) => void,
    911         ): this;
    912         prependOnceListener(
    913             event: "goaway",
    914             listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void,
    915         ): this;
    916         prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this;
    917         prependOnceListener(event: "ping", listener: () => void): this;
    918         prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
    919         prependOnceListener(event: "timeout", listener: () => void): this;
    920         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
    921     }
    922     export interface ClientHttp2Session extends Http2Session {
    923         /**
    924          * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an
    925          * HTTP/2 request to the connected server.
    926          *
    927          * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
    928          *
    929          * ```js
    930          * import http2 from 'node:http2';
    931          * const clientSession = http2.connect('https://localhost:1234');
    932          * const {
    933          *   HTTP2_HEADER_PATH,
    934          *   HTTP2_HEADER_STATUS,
    935          * } = http2.constants;
    936          *
    937          * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
    938          * req.on('response', (headers) => {
    939          *   console.log(headers[HTTP2_HEADER_STATUS]);
    940          *   req.on('data', (chunk) => { // ..  });
    941          *   req.on('end', () => { // ..  });
    942          * });
    943          * ```
    944          *
    945          * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
    946          * is emitted immediately after queuing the last chunk of payload data to be sent.
    947          * The `http2stream.sendTrailers()` method can then be called to send trailing
    948          * headers to the peer.
    949          *
    950          * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
    951          * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
    952          *
    953          * When `options.signal` is set with an `AbortSignal` and then `abort` on the
    954          * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error.
    955          *
    956          * The `:method` and `:path` pseudo-headers are not specified within `headers`,
    957          * they respectively default to:
    958          *
    959          * * `:method` \= `'GET'`
    960          * * `:path` \= `/`
    961          * @since v8.4.0
    962          */
    963         request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
    964         addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
    965         addListener(event: "origin", listener: (origins: string[]) => void): this;
    966         addListener(
    967             event: "connect",
    968             listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
    969         ): this;
    970         addListener(
    971             event: "stream",
    972             listener: (
    973                 stream: ClientHttp2Stream,
    974                 headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
    975                 flags: number,
    976             ) => void,
    977         ): this;
    978         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
    979         emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
    980         emit(event: "origin", origins: readonly string[]): boolean;
    981         emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
    982         emit(
    983             event: "stream",
    984             stream: ClientHttp2Stream,
    985             headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
    986             flags: number,
    987         ): boolean;
    988         emit(event: string | symbol, ...args: any[]): boolean;
    989         on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
    990         on(event: "origin", listener: (origins: string[]) => void): this;
    991         on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
    992         on(
    993             event: "stream",
    994             listener: (
    995                 stream: ClientHttp2Stream,
    996                 headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
    997                 flags: number,
    998             ) => void,
    999         ): this;
   1000         on(event: string | symbol, listener: (...args: any[]) => void): this;
   1001         once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
   1002         once(event: "origin", listener: (origins: string[]) => void): this;
   1003         once(
   1004             event: "connect",
   1005             listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
   1006         ): this;
   1007         once(
   1008             event: "stream",
   1009             listener: (
   1010                 stream: ClientHttp2Stream,
   1011                 headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
   1012                 flags: number,
   1013             ) => void,
   1014         ): this;
   1015         once(event: string | symbol, listener: (...args: any[]) => void): this;
   1016         prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
   1017         prependListener(event: "origin", listener: (origins: string[]) => void): this;
   1018         prependListener(
   1019             event: "connect",
   1020             listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
   1021         ): this;
   1022         prependListener(
   1023             event: "stream",
   1024             listener: (
   1025                 stream: ClientHttp2Stream,
   1026                 headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
   1027                 flags: number,
   1028             ) => void,
   1029         ): this;
   1030         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1031         prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
   1032         prependOnceListener(event: "origin", listener: (origins: string[]) => void): this;
   1033         prependOnceListener(
   1034             event: "connect",
   1035             listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
   1036         ): this;
   1037         prependOnceListener(
   1038             event: "stream",
   1039             listener: (
   1040                 stream: ClientHttp2Stream,
   1041                 headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
   1042                 flags: number,
   1043             ) => void,
   1044         ): this;
   1045         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1046     }
   1047     export interface AlternativeServiceOptions {
   1048         origin: number | string | url.URL;
   1049     }
   1050     export interface ServerHttp2Session<
   1051         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1052         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1053         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1054         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1055     > extends Http2Session {
   1056         readonly server:
   1057             | Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>
   1058             | Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
   1059         /**
   1060          * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
   1061          *
   1062          * ```js
   1063          * import http2 from 'node:http2';
   1064          *
   1065          * const server = http2.createServer();
   1066          * server.on('session', (session) => {
   1067          *   // Set altsvc for origin https://example.org:80
   1068          *   session.altsvc('h2=":8000"', 'https://example.org:80');
   1069          * });
   1070          *
   1071          * server.on('stream', (stream) => {
   1072          *   // Set altsvc for a specific stream
   1073          *   stream.session.altsvc('h2=":8000"', stream.id);
   1074          * });
   1075          * ```
   1076          *
   1077          * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate
   1078          * service is associated with the origin of the given `Http2Stream`.
   1079          *
   1080          * The `alt` and origin string _must_ contain only ASCII bytes and are
   1081          * 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
   1082          * domain.
   1083          *
   1084          * When a string is passed for the `originOrStream` argument, it will be parsed as
   1085          * a URL and the origin will be derived. For instance, the origin for the
   1086          * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string
   1087          * cannot be parsed as a URL or if a valid origin cannot be derived.
   1088          *
   1089          * 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
   1090          * used. The value of the `origin` property _must_ be a properly serialized
   1091          * ASCII origin.
   1092          * @since v9.4.0
   1093          * @param alt A description of the alternative service configuration as defined by `RFC 7838`.
   1094          * @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
   1095          * `http2stream.id` property.
   1096          */
   1097         altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void;
   1098         /**
   1099          * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client
   1100          * to advertise the set of origins for which the server is capable of providing
   1101          * authoritative responses.
   1102          *
   1103          * ```js
   1104          * import http2 from 'node:http2';
   1105          * const options = getSecureOptionsSomehow();
   1106          * const server = http2.createSecureServer(options);
   1107          * server.on('stream', (stream) => {
   1108          *   stream.respond();
   1109          *   stream.end('ok');
   1110          * });
   1111          * server.on('session', (session) => {
   1112          *   session.origin('https://example.com', 'https://example.org');
   1113          * });
   1114          * ```
   1115          *
   1116          * When a string is passed as an `origin`, it will be parsed as a URL and the
   1117          * 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
   1118          * string
   1119          * cannot be parsed as a URL or if a valid origin cannot be derived.
   1120          *
   1121          * A `URL` object, or any object with an `origin` property, may be passed as
   1122          * an `origin`, in which case the value of the `origin` property will be
   1123          * used. The value of the `origin` property _must_ be a properly serialized
   1124          * ASCII origin.
   1125          *
   1126          * Alternatively, the `origins` option may be used when creating a new HTTP/2
   1127          * server using the `http2.createSecureServer()` method:
   1128          *
   1129          * ```js
   1130          * import http2 from 'node:http2';
   1131          * const options = getSecureOptionsSomehow();
   1132          * options.origins = ['https://example.com', 'https://example.org'];
   1133          * const server = http2.createSecureServer(options);
   1134          * server.on('stream', (stream) => {
   1135          *   stream.respond();
   1136          *   stream.end('ok');
   1137          * });
   1138          * ```
   1139          * @since v10.12.0
   1140          * @param origins One or more URL Strings passed as separate arguments.
   1141          */
   1142         origin(
   1143             ...origins: Array<
   1144                 | string
   1145                 | url.URL
   1146                 | {
   1147                     origin: string;
   1148                 }
   1149             >
   1150         ): void;
   1151         addListener(
   1152             event: "connect",
   1153             listener: (
   1154                 session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1155                 socket: net.Socket | tls.TLSSocket,
   1156             ) => void,
   1157         ): this;
   1158         addListener(
   1159             event: "stream",
   1160             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1161         ): this;
   1162         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1163         emit(
   1164             event: "connect",
   1165             session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1166             socket: net.Socket | tls.TLSSocket,
   1167         ): boolean;
   1168         emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
   1169         emit(event: string | symbol, ...args: any[]): boolean;
   1170         on(
   1171             event: "connect",
   1172             listener: (
   1173                 session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1174                 socket: net.Socket | tls.TLSSocket,
   1175             ) => void,
   1176         ): this;
   1177         on(
   1178             event: "stream",
   1179             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1180         ): this;
   1181         on(event: string | symbol, listener: (...args: any[]) => void): this;
   1182         once(
   1183             event: "connect",
   1184             listener: (
   1185                 session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1186                 socket: net.Socket | tls.TLSSocket,
   1187             ) => void,
   1188         ): this;
   1189         once(
   1190             event: "stream",
   1191             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1192         ): this;
   1193         once(event: string | symbol, listener: (...args: any[]) => void): this;
   1194         prependListener(
   1195             event: "connect",
   1196             listener: (
   1197                 session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1198                 socket: net.Socket | tls.TLSSocket,
   1199             ) => void,
   1200         ): this;
   1201         prependListener(
   1202             event: "stream",
   1203             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1204         ): this;
   1205         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1206         prependOnceListener(
   1207             event: "connect",
   1208             listener: (
   1209                 session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1210                 socket: net.Socket | tls.TLSSocket,
   1211             ) => void,
   1212         ): this;
   1213         prependOnceListener(
   1214             event: "stream",
   1215             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1216         ): this;
   1217         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1218     }
   1219     // Http2Server
   1220     export interface SessionOptions {
   1221         maxDeflateDynamicTableSize?: number | undefined;
   1222         maxSessionMemory?: number | undefined;
   1223         maxHeaderListPairs?: number | undefined;
   1224         maxOutstandingPings?: number | undefined;
   1225         maxSendHeaderBlockLength?: number | undefined;
   1226         paddingStrategy?: number | undefined;
   1227         peerMaxConcurrentStreams?: number | undefined;
   1228         settings?: Settings | undefined;
   1229         /**
   1230          * Specifies a timeout in milliseconds that
   1231          * a server should wait when an [`'unknownProtocol'`][] is emitted. If the
   1232          * socket has not been destroyed by that time the server will destroy it.
   1233          * @default 100000
   1234          */
   1235         unknownProtocolTimeout?: number | undefined;
   1236         selectPadding?(frameLen: number, maxFrameLen: number): number;
   1237     }
   1238     export interface ClientSessionOptions extends SessionOptions {
   1239         maxReservedRemoteStreams?: number | undefined;
   1240         createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
   1241         protocol?: "http:" | "https:" | undefined;
   1242     }
   1243     export interface ServerSessionOptions<
   1244         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1245         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1246         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1247         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1248     > extends SessionOptions {
   1249         Http1IncomingMessage?: Http1Request | undefined;
   1250         Http1ServerResponse?: Http1Response | undefined;
   1251         Http2ServerRequest?: Http2Request | undefined;
   1252         Http2ServerResponse?: Http2Response | undefined;
   1253     }
   1254     export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
   1255     export interface SecureServerSessionOptions<
   1256         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1257         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1258         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1259         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1260     > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
   1261     export interface ServerOptions<
   1262         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1263         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1264         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1265         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1266     > extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
   1267     export interface SecureServerOptions<
   1268         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1269         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1270         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1271         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1272     > extends SecureServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
   1273         allowHTTP1?: boolean | undefined;
   1274         origins?: string[] | undefined;
   1275     }
   1276     interface HTTP2ServerCommon {
   1277         setTimeout(msec?: number, callback?: () => void): this;
   1278         /**
   1279          * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
   1280          * Throws ERR_INVALID_ARG_TYPE for invalid settings argument.
   1281          */
   1282         updateSettings(settings: Settings): void;
   1283     }
   1284     export interface Http2Server<
   1285         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1286         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1287         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1288         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1289     > extends net.Server, HTTP2ServerCommon {
   1290         addListener(
   1291             event: "checkContinue",
   1292             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1293         ): this;
   1294         addListener(
   1295             event: "request",
   1296             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1297         ): this;
   1298         addListener(
   1299             event: "session",
   1300             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1301         ): this;
   1302         addListener(event: "sessionError", listener: (err: Error) => void): this;
   1303         addListener(
   1304             event: "stream",
   1305             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1306         ): this;
   1307         addListener(event: "timeout", listener: () => void): this;
   1308         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1309         emit(
   1310             event: "checkContinue",
   1311             request: InstanceType<Http2Request>,
   1312             response: InstanceType<Http2Response>,
   1313         ): boolean;
   1314         emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
   1315         emit(
   1316             event: "session",
   1317             session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1318         ): boolean;
   1319         emit(event: "sessionError", err: Error): boolean;
   1320         emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
   1321         emit(event: "timeout"): boolean;
   1322         emit(event: string | symbol, ...args: any[]): boolean;
   1323         on(
   1324             event: "checkContinue",
   1325             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1326         ): this;
   1327         on(
   1328             event: "request",
   1329             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1330         ): this;
   1331         on(
   1332             event: "session",
   1333             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1334         ): this;
   1335         on(event: "sessionError", listener: (err: Error) => void): this;
   1336         on(
   1337             event: "stream",
   1338             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1339         ): this;
   1340         on(event: "timeout", listener: () => void): this;
   1341         on(event: string | symbol, listener: (...args: any[]) => void): this;
   1342         once(
   1343             event: "checkContinue",
   1344             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1345         ): this;
   1346         once(
   1347             event: "request",
   1348             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1349         ): this;
   1350         once(
   1351             event: "session",
   1352             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1353         ): this;
   1354         once(event: "sessionError", listener: (err: Error) => void): this;
   1355         once(
   1356             event: "stream",
   1357             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1358         ): this;
   1359         once(event: "timeout", listener: () => void): this;
   1360         once(event: string | symbol, listener: (...args: any[]) => void): this;
   1361         prependListener(
   1362             event: "checkContinue",
   1363             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1364         ): this;
   1365         prependListener(
   1366             event: "request",
   1367             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1368         ): this;
   1369         prependListener(
   1370             event: "session",
   1371             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1372         ): this;
   1373         prependListener(event: "sessionError", listener: (err: Error) => void): this;
   1374         prependListener(
   1375             event: "stream",
   1376             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1377         ): this;
   1378         prependListener(event: "timeout", listener: () => void): this;
   1379         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1380         prependOnceListener(
   1381             event: "checkContinue",
   1382             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1383         ): this;
   1384         prependOnceListener(
   1385             event: "request",
   1386             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1387         ): this;
   1388         prependOnceListener(
   1389             event: "session",
   1390             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1391         ): this;
   1392         prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
   1393         prependOnceListener(
   1394             event: "stream",
   1395             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1396         ): this;
   1397         prependOnceListener(event: "timeout", listener: () => void): this;
   1398         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1399     }
   1400     export interface Http2SecureServer<
   1401         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   1402         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   1403         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   1404         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   1405     > extends tls.Server, HTTP2ServerCommon {
   1406         addListener(
   1407             event: "checkContinue",
   1408             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1409         ): this;
   1410         addListener(
   1411             event: "request",
   1412             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1413         ): this;
   1414         addListener(
   1415             event: "session",
   1416             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1417         ): this;
   1418         addListener(event: "sessionError", listener: (err: Error) => void): this;
   1419         addListener(
   1420             event: "stream",
   1421             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1422         ): this;
   1423         addListener(event: "timeout", listener: () => void): this;
   1424         addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
   1425         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1426         emit(
   1427             event: "checkContinue",
   1428             request: InstanceType<Http2Request>,
   1429             response: InstanceType<Http2Response>,
   1430         ): boolean;
   1431         emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
   1432         emit(
   1433             event: "session",
   1434             session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
   1435         ): boolean;
   1436         emit(event: "sessionError", err: Error): boolean;
   1437         emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
   1438         emit(event: "timeout"): boolean;
   1439         emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
   1440         emit(event: string | symbol, ...args: any[]): boolean;
   1441         on(
   1442             event: "checkContinue",
   1443             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1444         ): this;
   1445         on(
   1446             event: "request",
   1447             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1448         ): this;
   1449         on(
   1450             event: "session",
   1451             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1452         ): this;
   1453         on(event: "sessionError", listener: (err: Error) => void): this;
   1454         on(
   1455             event: "stream",
   1456             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1457         ): this;
   1458         on(event: "timeout", listener: () => void): this;
   1459         on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
   1460         on(event: string | symbol, listener: (...args: any[]) => void): this;
   1461         once(
   1462             event: "checkContinue",
   1463             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1464         ): this;
   1465         once(
   1466             event: "request",
   1467             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1468         ): this;
   1469         once(
   1470             event: "session",
   1471             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1472         ): this;
   1473         once(event: "sessionError", listener: (err: Error) => void): this;
   1474         once(
   1475             event: "stream",
   1476             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1477         ): this;
   1478         once(event: "timeout", listener: () => void): this;
   1479         once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
   1480         once(event: string | symbol, listener: (...args: any[]) => void): this;
   1481         prependListener(
   1482             event: "checkContinue",
   1483             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1484         ): this;
   1485         prependListener(
   1486             event: "request",
   1487             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1488         ): this;
   1489         prependListener(
   1490             event: "session",
   1491             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1492         ): this;
   1493         prependListener(event: "sessionError", listener: (err: Error) => void): this;
   1494         prependListener(
   1495             event: "stream",
   1496             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1497         ): this;
   1498         prependListener(event: "timeout", listener: () => void): this;
   1499         prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
   1500         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1501         prependOnceListener(
   1502             event: "checkContinue",
   1503             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1504         ): this;
   1505         prependOnceListener(
   1506             event: "request",
   1507             listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   1508         ): this;
   1509         prependOnceListener(
   1510             event: "session",
   1511             listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
   1512         ): this;
   1513         prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
   1514         prependOnceListener(
   1515             event: "stream",
   1516             listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
   1517         ): this;
   1518         prependOnceListener(event: "timeout", listener: () => void): this;
   1519         prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
   1520         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1521     }
   1522     /**
   1523      * 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,
   1524      * headers, and
   1525      * data.
   1526      * @since v8.4.0
   1527      */
   1528     export class Http2ServerRequest extends stream.Readable {
   1529         constructor(
   1530             stream: ServerHttp2Stream,
   1531             headers: IncomingHttpHeaders,
   1532             options: stream.ReadableOptions,
   1533             rawHeaders: readonly string[],
   1534         );
   1535         /**
   1536          * The `request.aborted` property will be `true` if the request has
   1537          * been aborted.
   1538          * @since v10.1.0
   1539          */
   1540         readonly aborted: boolean;
   1541         /**
   1542          * The request authority pseudo header field. Because HTTP/2 allows requests
   1543          * to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`.
   1544          * @since v8.4.0
   1545          */
   1546         readonly authority: string;
   1547         /**
   1548          * See `request.socket`.
   1549          * @since v8.4.0
   1550          * @deprecated Since v13.0.0 - Use `socket`.
   1551          */
   1552         readonly connection: net.Socket | tls.TLSSocket;
   1553         /**
   1554          * The `request.complete` property will be `true` if the request has
   1555          * been completed, aborted, or destroyed.
   1556          * @since v12.10.0
   1557          */
   1558         readonly complete: boolean;
   1559         /**
   1560          * The request/response headers object.
   1561          *
   1562          * Key-value pairs of header names and values. Header names are lower-cased.
   1563          *
   1564          * ```js
   1565          * // Prints something like:
   1566          * //
   1567          * // { 'user-agent': 'curl/7.22.0',
   1568          * //   host: '127.0.0.1:8000',
   1569          * //   accept: '*' }
   1570          * console.log(request.headers);
   1571          * ```f
   1572          *
   1573          * See `HTTP/2 Headers Object`.
   1574          *
   1575          * In HTTP/2, the request path, host name, protocol, and method are represented as
   1576          * special headers prefixed with the `:` character (e.g. `':path'`). These special
   1577          * headers will be included in the `request.headers` object. Care must be taken not
   1578          * to inadvertently modify these special headers or errors may occur. For instance,
   1579          * removing all headers from the request will cause errors to occur:
   1580          *
   1581          * ```js
   1582          * removeAllHeaders(request.headers);
   1583          * assert(request.url);   // Fails because the :path header has been removed
   1584          * ```
   1585          * @since v8.4.0
   1586          */
   1587         readonly headers: IncomingHttpHeaders;
   1588         /**
   1589          * In case of server request, the HTTP version sent by the client. In the case of
   1590          * client response, the HTTP version of the connected-to server. Returns `'2.0'`.
   1591          *
   1592          * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
   1593          * @since v8.4.0
   1594          */
   1595         readonly httpVersion: string;
   1596         readonly httpVersionMinor: number;
   1597         readonly httpVersionMajor: number;
   1598         /**
   1599          * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`.
   1600          * @since v8.4.0
   1601          */
   1602         readonly method: string;
   1603         /**
   1604          * The raw request/response headers list exactly as they were received.
   1605          *
   1606          * The keys and values are in the same list. It is _not_ a
   1607          * list of tuples. So, the even-numbered offsets are key values, and the
   1608          * odd-numbered offsets are the associated values.
   1609          *
   1610          * Header names are not lowercased, and duplicates are not merged.
   1611          *
   1612          * ```js
   1613          * // Prints something like:
   1614          * //
   1615          * // [ 'user-agent',
   1616          * //   'this is invalid because there can be only one',
   1617          * //   'User-Agent',
   1618          * //   'curl/7.22.0',
   1619          * //   'Host',
   1620          * //   '127.0.0.1:8000',
   1621          * //   'ACCEPT',
   1622          * //   '*' ]
   1623          * console.log(request.rawHeaders);
   1624          * ```
   1625          * @since v8.4.0
   1626          */
   1627         readonly rawHeaders: string[];
   1628         /**
   1629          * The raw request/response trailer keys and values exactly as they were
   1630          * received. Only populated at the `'end'` event.
   1631          * @since v8.4.0
   1632          */
   1633         readonly rawTrailers: string[];
   1634         /**
   1635          * The request scheme pseudo header field indicating the scheme
   1636          * portion of the target URL.
   1637          * @since v8.4.0
   1638          */
   1639         readonly scheme: string;
   1640         /**
   1641          * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
   1642          * applies getters, setters, and methods based on HTTP/2 logic.
   1643          *
   1644          * `destroyed`, `readable`, and `writable` properties will be retrieved from and
   1645          * set on `request.stream`.
   1646          *
   1647          * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`.
   1648          *
   1649          * `setTimeout` method will be called on `request.stream.session`.
   1650          *
   1651          * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
   1652          * more information.
   1653          *
   1654          * All other interactions will be routed directly to the socket. With TLS support,
   1655          * use `request.socket.getPeerCertificate()` to obtain the client's
   1656          * authentication details.
   1657          * @since v8.4.0
   1658          */
   1659         readonly socket: net.Socket | tls.TLSSocket;
   1660         /**
   1661          * The `Http2Stream` object backing the request.
   1662          * @since v8.4.0
   1663          */
   1664         readonly stream: ServerHttp2Stream;
   1665         /**
   1666          * The request/response trailers object. Only populated at the `'end'` event.
   1667          * @since v8.4.0
   1668          */
   1669         readonly trailers: IncomingHttpHeaders;
   1670         /**
   1671          * Request URL string. This contains only the URL that is present in the actual
   1672          * HTTP request. If the request is:
   1673          *
   1674          * ```http
   1675          * GET /status?name=ryan HTTP/1.1
   1676          * Accept: text/plain
   1677          * ```
   1678          *
   1679          * Then `request.url` will be:
   1680          *
   1681          * ```js
   1682          * '/status?name=ryan'
   1683          * ```
   1684          *
   1685          * To parse the url into its parts, `new URL()` can be used:
   1686          *
   1687          * ```console
   1688          * $ node
   1689          * > new URL('/status?name=ryan', 'http://example.com')
   1690          * URL {
   1691          *   href: 'http://example.com/status?name=ryan',
   1692          *   origin: 'http://example.com',
   1693          *   protocol: 'http:',
   1694          *   username: '',
   1695          *   password: '',
   1696          *   host: 'example.com',
   1697          *   hostname: 'example.com',
   1698          *   port: '',
   1699          *   pathname: '/status',
   1700          *   search: '?name=ryan',
   1701          *   searchParams: URLSearchParams { 'name' => 'ryan' },
   1702          *   hash: ''
   1703          * }
   1704          * ```
   1705          * @since v8.4.0
   1706          */
   1707         url: string;
   1708         /**
   1709          * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is
   1710          * provided, then it is added as a listener on the `'timeout'` event on
   1711          * the response object.
   1712          *
   1713          * If no `'timeout'` listener is added to the request, the response, or
   1714          * the server, then `Http2Stream`s are destroyed when they time out. If a
   1715          * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
   1716          * @since v8.4.0
   1717          */
   1718         setTimeout(msecs: number, callback?: () => void): void;
   1719         read(size?: number): Buffer | string | null;
   1720         addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
   1721         addListener(event: "close", listener: () => void): this;
   1722         addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
   1723         addListener(event: "end", listener: () => void): this;
   1724         addListener(event: "readable", listener: () => void): this;
   1725         addListener(event: "error", listener: (err: Error) => void): this;
   1726         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1727         emit(event: "aborted", hadError: boolean, code: number): boolean;
   1728         emit(event: "close"): boolean;
   1729         emit(event: "data", chunk: Buffer | string): boolean;
   1730         emit(event: "end"): boolean;
   1731         emit(event: "readable"): boolean;
   1732         emit(event: "error", err: Error): boolean;
   1733         emit(event: string | symbol, ...args: any[]): boolean;
   1734         on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
   1735         on(event: "close", listener: () => void): this;
   1736         on(event: "data", listener: (chunk: Buffer | string) => void): this;
   1737         on(event: "end", listener: () => void): this;
   1738         on(event: "readable", listener: () => void): this;
   1739         on(event: "error", listener: (err: Error) => void): this;
   1740         on(event: string | symbol, listener: (...args: any[]) => void): this;
   1741         once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
   1742         once(event: "close", listener: () => void): this;
   1743         once(event: "data", listener: (chunk: Buffer | string) => void): this;
   1744         once(event: "end", listener: () => void): this;
   1745         once(event: "readable", listener: () => void): this;
   1746         once(event: "error", listener: (err: Error) => void): this;
   1747         once(event: string | symbol, listener: (...args: any[]) => void): this;
   1748         prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
   1749         prependListener(event: "close", listener: () => void): this;
   1750         prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
   1751         prependListener(event: "end", listener: () => void): this;
   1752         prependListener(event: "readable", listener: () => void): this;
   1753         prependListener(event: "error", listener: (err: Error) => void): this;
   1754         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1755         prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
   1756         prependOnceListener(event: "close", listener: () => void): this;
   1757         prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
   1758         prependOnceListener(event: "end", listener: () => void): this;
   1759         prependOnceListener(event: "readable", listener: () => void): this;
   1760         prependOnceListener(event: "error", listener: (err: Error) => void): this;
   1761         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
   1762     }
   1763     /**
   1764      * This object is created internally by an HTTP server, not by the user. It is
   1765      * passed as the second parameter to the `'request'` event.
   1766      * @since v8.4.0
   1767      */
   1768     export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
   1769         constructor(stream: ServerHttp2Stream);
   1770         /**
   1771          * See `response.socket`.
   1772          * @since v8.4.0
   1773          * @deprecated Since v13.0.0 - Use `socket`.
   1774          */
   1775         readonly connection: net.Socket | tls.TLSSocket;
   1776         /**
   1777          * Boolean value that indicates whether the response has completed. Starts
   1778          * as `false`. After `response.end()` executes, the value will be `true`.
   1779          * @since v8.4.0
   1780          * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`.
   1781          */
   1782         readonly finished: boolean;
   1783         /**
   1784          * True if headers were sent, false otherwise (read-only).
   1785          * @since v8.4.0
   1786          */
   1787         readonly headersSent: boolean;
   1788         /**
   1789          * A reference to the original HTTP2 `request` object.
   1790          * @since v15.7.0
   1791          */
   1792         readonly req: Request;
   1793         /**
   1794          * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
   1795          * applies getters, setters, and methods based on HTTP/2 logic.
   1796          *
   1797          * `destroyed`, `readable`, and `writable` properties will be retrieved from and
   1798          * set on `response.stream`.
   1799          *
   1800          * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`.
   1801          *
   1802          * `setTimeout` method will be called on `response.stream.session`.
   1803          *
   1804          * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
   1805          * more information.
   1806          *
   1807          * All other interactions will be routed directly to the socket.
   1808          *
   1809          * ```js
   1810          * import http2 from 'node:http2';
   1811          * const server = http2.createServer((req, res) => {
   1812          *   const ip = req.socket.remoteAddress;
   1813          *   const port = req.socket.remotePort;
   1814          *   res.end(`Your IP address is ${ip} and your source port is ${port}.`);
   1815          * }).listen(3000);
   1816          * ```
   1817          * @since v8.4.0
   1818          */
   1819         readonly socket: net.Socket | tls.TLSSocket;
   1820         /**
   1821          * The `Http2Stream` object backing the response.
   1822          * @since v8.4.0
   1823          */
   1824         readonly stream: ServerHttp2Stream;
   1825         /**
   1826          * When true, the Date header will be automatically generated and sent in
   1827          * the response if it is not already present in the headers. Defaults to true.
   1828          *
   1829          * This should only be disabled for testing; HTTP requires the Date header
   1830          * in responses.
   1831          * @since v8.4.0
   1832          */
   1833         sendDate: boolean;
   1834         /**
   1835          * When using implicit headers (not calling `response.writeHead()` explicitly),
   1836          * this property controls the status code that will be sent to the client when
   1837          * the headers get flushed.
   1838          *
   1839          * ```js
   1840          * response.statusCode = 404;
   1841          * ```
   1842          *
   1843          * After response header was sent to the client, this property indicates the
   1844          * status code which was sent out.
   1845          * @since v8.4.0
   1846          */
   1847         statusCode: number;
   1848         /**
   1849          * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns
   1850          * an empty string.
   1851          * @since v8.4.0
   1852          */
   1853         statusMessage: "";
   1854         /**
   1855          * This method adds HTTP trailing headers (a header but at the end of the
   1856          * message) to the response.
   1857          *
   1858          * Attempting to set a header field name or value that contains invalid characters
   1859          * will result in a `TypeError` being thrown.
   1860          * @since v8.4.0
   1861          */
   1862         addTrailers(trailers: OutgoingHttpHeaders): void;
   1863         /**
   1864          * This method signals to the server that all of the response headers and body
   1865          * have been sent; that server should consider this message complete.
   1866          * The method, `response.end()`, MUST be called on each response.
   1867          *
   1868          * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`.
   1869          *
   1870          * If `callback` is specified, it will be called when the response stream
   1871          * is finished.
   1872          * @since v8.4.0
   1873          */
   1874         end(callback?: () => void): this;
   1875         end(data: string | Uint8Array, callback?: () => void): this;
   1876         end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this;
   1877         /**
   1878          * Reads out a header that has already been queued but not sent to the client.
   1879          * The name is case-insensitive.
   1880          *
   1881          * ```js
   1882          * const contentType = response.getHeader('content-type');
   1883          * ```
   1884          * @since v8.4.0
   1885          */
   1886         getHeader(name: string): string;
   1887         /**
   1888          * Returns an array containing the unique names of the current outgoing headers.
   1889          * All header names are lowercase.
   1890          *
   1891          * ```js
   1892          * response.setHeader('Foo', 'bar');
   1893          * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
   1894          *
   1895          * const headerNames = response.getHeaderNames();
   1896          * // headerNames === ['foo', 'set-cookie']
   1897          * ```
   1898          * @since v8.4.0
   1899          */
   1900         getHeaderNames(): string[];
   1901         /**
   1902          * Returns a shallow copy of the current outgoing headers. Since a shallow copy
   1903          * is used, array values may be mutated without additional calls to various
   1904          * header-related http module methods. The keys of the returned object are the
   1905          * header names and the values are the respective header values. All header names
   1906          * are lowercase.
   1907          *
   1908          * 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()`,
   1909          * `obj.hasOwnProperty()`, and others
   1910          * are not defined and _will not work_.
   1911          *
   1912          * ```js
   1913          * response.setHeader('Foo', 'bar');
   1914          * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
   1915          *
   1916          * const headers = response.getHeaders();
   1917          * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
   1918          * ```
   1919          * @since v8.4.0
   1920          */
   1921         getHeaders(): OutgoingHttpHeaders;
   1922         /**
   1923          * Returns `true` if the header identified by `name` is currently set in the
   1924          * outgoing headers. The header name matching is case-insensitive.
   1925          *
   1926          * ```js
   1927          * const hasContentType = response.hasHeader('content-type');
   1928          * ```
   1929          * @since v8.4.0
   1930          */
   1931         hasHeader(name: string): boolean;
   1932         /**
   1933          * Removes a header that has been queued for implicit sending.
   1934          *
   1935          * ```js
   1936          * response.removeHeader('Content-Encoding');
   1937          * ```
   1938          * @since v8.4.0
   1939          */
   1940         removeHeader(name: string): void;
   1941         /**
   1942          * Sets a single header value for implicit headers. If this header already exists
   1943          * in the to-be-sent headers, its value will be replaced. Use an array of strings
   1944          * here to send multiple headers with the same name.
   1945          *
   1946          * ```js
   1947          * response.setHeader('Content-Type', 'text/html; charset=utf-8');
   1948          * ```
   1949          *
   1950          * or
   1951          *
   1952          * ```js
   1953          * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
   1954          * ```
   1955          *
   1956          * Attempting to set a header field name or value that contains invalid characters
   1957          * will result in a `TypeError` being thrown.
   1958          *
   1959          * When headers have been set with `response.setHeader()`, they will be merged
   1960          * with any headers passed to `response.writeHead()`, with the headers passed
   1961          * to `response.writeHead()` given precedence.
   1962          *
   1963          * ```js
   1964          * // Returns content-type = text/plain
   1965          * const server = http2.createServer((req, res) => {
   1966          *   res.setHeader('Content-Type', 'text/html; charset=utf-8');
   1967          *   res.setHeader('X-Foo', 'bar');
   1968          *   res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
   1969          *   res.end('ok');
   1970          * });
   1971          * ```
   1972          * @since v8.4.0
   1973          */
   1974         setHeader(name: string, value: number | string | readonly string[]): void;
   1975         /**
   1976          * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is
   1977          * provided, then it is added as a listener on the `'timeout'` event on
   1978          * the response object.
   1979          *
   1980          * If no `'timeout'` listener is added to the request, the response, or
   1981          * the server, then `Http2Stream` s are destroyed when they time out. If a
   1982          * handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly.
   1983          * @since v8.4.0
   1984          */
   1985         setTimeout(msecs: number, callback?: () => void): void;
   1986         /**
   1987          * If this method is called and `response.writeHead()` has not been called,
   1988          * it will switch to implicit header mode and flush the implicit headers.
   1989          *
   1990          * This sends a chunk of the response body. This method may
   1991          * be called multiple times to provide successive parts of the body.
   1992          *
   1993          * In the `node:http` module, the response body is omitted when the
   1994          * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body.
   1995          *
   1996          * `chunk` can be a string or a buffer. If `chunk` is a string,
   1997          * the second parameter specifies how to encode it into a byte stream.
   1998          * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk
   1999          * of data is flushed.
   2000          *
   2001          * This is the raw HTTP body and has nothing to do with higher-level multi-part
   2002          * body encodings that may be used.
   2003          *
   2004          * The first time `response.write()` is called, it will send the buffered
   2005          * header information and the first chunk of the body to the client. The second
   2006          * time `response.write()` is called, Node.js assumes data will be streamed,
   2007          * and sends the new data separately. That is, the response is buffered up to the
   2008          * first chunk of the body.
   2009          *
   2010          * Returns `true` if the entire data was flushed successfully to the kernel
   2011          * 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.
   2012          * @since v8.4.0
   2013          */
   2014         write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
   2015         write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean;
   2016         /**
   2017          * Sends a status `100 Continue` to the client, indicating that the request body
   2018          * should be sent. See the `'checkContinue'` event on `Http2Server` and `Http2SecureServer`.
   2019          * @since v8.4.0
   2020          */
   2021         writeContinue(): void;
   2022         /**
   2023          * Sends a response header to the request. The status code is a 3-digit HTTP
   2024          * status code, like `404`. The last argument, `headers`, are the response headers.
   2025          *
   2026          * Returns a reference to the `Http2ServerResponse`, so that calls can be chained.
   2027          *
   2028          * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be
   2029          * passed as the second argument. However, because the `statusMessage` has no
   2030          * meaning within HTTP/2, the argument will have no effect and a process warning
   2031          * will be emitted.
   2032          *
   2033          * ```js
   2034          * const body = 'hello world';
   2035          * response.writeHead(200, {
   2036          *   'Content-Length': Buffer.byteLength(body),
   2037          *   'Content-Type': 'text/plain; charset=utf-8',
   2038          * });
   2039          * ```
   2040          *
   2041          * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a
   2042          * given encoding. On outbound messages, Node.js does not check if Content-Length
   2043          * and the length of the body being transmitted are equal or not. However, when
   2044          * receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size.
   2045          *
   2046          * This method may be called at most one time on a message before `response.end()` is called.
   2047          *
   2048          * If `response.write()` or `response.end()` are called before calling
   2049          * this, the implicit/mutable headers will be calculated and call this function.
   2050          *
   2051          * When headers have been set with `response.setHeader()`, they will be merged
   2052          * with any headers passed to `response.writeHead()`, with the headers passed
   2053          * to `response.writeHead()` given precedence.
   2054          *
   2055          * ```js
   2056          * // Returns content-type = text/plain
   2057          * const server = http2.createServer((req, res) => {
   2058          *   res.setHeader('Content-Type', 'text/html; charset=utf-8');
   2059          *   res.setHeader('X-Foo', 'bar');
   2060          *   res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
   2061          *   res.end('ok');
   2062          * });
   2063          * ```
   2064          *
   2065          * Attempting to set a header field name or value that contains invalid characters
   2066          * will result in a `TypeError` being thrown.
   2067          * @since v8.4.0
   2068          */
   2069         writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
   2070         writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
   2071         /**
   2072          * Call `http2stream.pushStream()` with the given headers, and wrap the
   2073          * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback
   2074          * parameter if successful. When `Http2ServerRequest` is closed, the callback is
   2075          * called with an error `ERR_HTTP2_INVALID_STREAM`.
   2076          * @since v8.4.0
   2077          * @param headers An object describing the headers
   2078          * @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
   2079          * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method
   2080          */
   2081         createPushResponse(
   2082             headers: OutgoingHttpHeaders,
   2083             callback: (err: Error | null, res: Http2ServerResponse) => void,
   2084         ): void;
   2085         addListener(event: "close", listener: () => void): this;
   2086         addListener(event: "drain", listener: () => void): this;
   2087         addListener(event: "error", listener: (error: Error) => void): this;
   2088         addListener(event: "finish", listener: () => void): this;
   2089         addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
   2090         addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
   2091         addListener(event: string | symbol, listener: (...args: any[]) => void): this;
   2092         emit(event: "close"): boolean;
   2093         emit(event: "drain"): boolean;
   2094         emit(event: "error", error: Error): boolean;
   2095         emit(event: "finish"): boolean;
   2096         emit(event: "pipe", src: stream.Readable): boolean;
   2097         emit(event: "unpipe", src: stream.Readable): boolean;
   2098         emit(event: string | symbol, ...args: any[]): boolean;
   2099         on(event: "close", listener: () => void): this;
   2100         on(event: "drain", listener: () => void): this;
   2101         on(event: "error", listener: (error: Error) => void): this;
   2102         on(event: "finish", listener: () => void): this;
   2103         on(event: "pipe", listener: (src: stream.Readable) => void): this;
   2104         on(event: "unpipe", listener: (src: stream.Readable) => void): this;
   2105         on(event: string | symbol, listener: (...args: any[]) => void): this;
   2106         once(event: "close", listener: () => void): this;
   2107         once(event: "drain", listener: () => void): this;
   2108         once(event: "error", listener: (error: Error) => void): this;
   2109         once(event: "finish", listener: () => void): this;
   2110         once(event: "pipe", listener: (src: stream.Readable) => void): this;
   2111         once(event: "unpipe", listener: (src: stream.Readable) => void): this;
   2112         once(event: string | symbol, listener: (...args: any[]) => void): this;
   2113         prependListener(event: "close", listener: () => void): this;
   2114         prependListener(event: "drain", listener: () => void): this;
   2115         prependListener(event: "error", listener: (error: Error) => void): this;
   2116         prependListener(event: "finish", listener: () => void): this;
   2117         prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
   2118         prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
   2119         prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
   2120         prependOnceListener(event: "close", listener: () => void): this;
   2121         prependOnceListener(event: "drain", listener: () => void): this;
   2122         prependOnceListener(event: "error", listener: (error: Error) => void): this;
   2123         prependOnceListener(event: "finish", listener: () => void): this;
   2124         prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
   2125         prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
   2126         prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
   2127     }
   2128     export namespace constants {
   2129         const NGHTTP2_SESSION_SERVER: number;
   2130         const NGHTTP2_SESSION_CLIENT: number;
   2131         const NGHTTP2_STREAM_STATE_IDLE: number;
   2132         const NGHTTP2_STREAM_STATE_OPEN: number;
   2133         const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number;
   2134         const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number;
   2135         const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number;
   2136         const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number;
   2137         const NGHTTP2_STREAM_STATE_CLOSED: number;
   2138         const NGHTTP2_NO_ERROR: number;
   2139         const NGHTTP2_PROTOCOL_ERROR: number;
   2140         const NGHTTP2_INTERNAL_ERROR: number;
   2141         const NGHTTP2_FLOW_CONTROL_ERROR: number;
   2142         const NGHTTP2_SETTINGS_TIMEOUT: number;
   2143         const NGHTTP2_STREAM_CLOSED: number;
   2144         const NGHTTP2_FRAME_SIZE_ERROR: number;
   2145         const NGHTTP2_REFUSED_STREAM: number;
   2146         const NGHTTP2_CANCEL: number;
   2147         const NGHTTP2_COMPRESSION_ERROR: number;
   2148         const NGHTTP2_CONNECT_ERROR: number;
   2149         const NGHTTP2_ENHANCE_YOUR_CALM: number;
   2150         const NGHTTP2_INADEQUATE_SECURITY: number;
   2151         const NGHTTP2_HTTP_1_1_REQUIRED: number;
   2152         const NGHTTP2_ERR_FRAME_SIZE_ERROR: number;
   2153         const NGHTTP2_FLAG_NONE: number;
   2154         const NGHTTP2_FLAG_END_STREAM: number;
   2155         const NGHTTP2_FLAG_END_HEADERS: number;
   2156         const NGHTTP2_FLAG_ACK: number;
   2157         const NGHTTP2_FLAG_PADDED: number;
   2158         const NGHTTP2_FLAG_PRIORITY: number;
   2159         const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number;
   2160         const DEFAULT_SETTINGS_ENABLE_PUSH: number;
   2161         const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number;
   2162         const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number;
   2163         const MAX_MAX_FRAME_SIZE: number;
   2164         const MIN_MAX_FRAME_SIZE: number;
   2165         const MAX_INITIAL_WINDOW_SIZE: number;
   2166         const NGHTTP2_DEFAULT_WEIGHT: number;
   2167         const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number;
   2168         const NGHTTP2_SETTINGS_ENABLE_PUSH: number;
   2169         const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number;
   2170         const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number;
   2171         const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number;
   2172         const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number;
   2173         const PADDING_STRATEGY_NONE: number;
   2174         const PADDING_STRATEGY_MAX: number;
   2175         const PADDING_STRATEGY_CALLBACK: number;
   2176         const HTTP2_HEADER_STATUS: string;
   2177         const HTTP2_HEADER_METHOD: string;
   2178         const HTTP2_HEADER_AUTHORITY: string;
   2179         const HTTP2_HEADER_SCHEME: string;
   2180         const HTTP2_HEADER_PATH: string;
   2181         const HTTP2_HEADER_ACCEPT_CHARSET: string;
   2182         const HTTP2_HEADER_ACCEPT_ENCODING: string;
   2183         const HTTP2_HEADER_ACCEPT_LANGUAGE: string;
   2184         const HTTP2_HEADER_ACCEPT_RANGES: string;
   2185         const HTTP2_HEADER_ACCEPT: string;
   2186         const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: string;
   2187         const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: string;
   2188         const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: string;
   2189         const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string;
   2190         const HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: string;
   2191         const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: string;
   2192         const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: string;
   2193         const HTTP2_HEADER_AGE: string;
   2194         const HTTP2_HEADER_ALLOW: string;
   2195         const HTTP2_HEADER_AUTHORIZATION: string;
   2196         const HTTP2_HEADER_CACHE_CONTROL: string;
   2197         const HTTP2_HEADER_CONNECTION: string;
   2198         const HTTP2_HEADER_CONTENT_DISPOSITION: string;
   2199         const HTTP2_HEADER_CONTENT_ENCODING: string;
   2200         const HTTP2_HEADER_CONTENT_LANGUAGE: string;
   2201         const HTTP2_HEADER_CONTENT_LENGTH: string;
   2202         const HTTP2_HEADER_CONTENT_LOCATION: string;
   2203         const HTTP2_HEADER_CONTENT_MD5: string;
   2204         const HTTP2_HEADER_CONTENT_RANGE: string;
   2205         const HTTP2_HEADER_CONTENT_TYPE: string;
   2206         const HTTP2_HEADER_COOKIE: string;
   2207         const HTTP2_HEADER_DATE: string;
   2208         const HTTP2_HEADER_ETAG: string;
   2209         const HTTP2_HEADER_EXPECT: string;
   2210         const HTTP2_HEADER_EXPIRES: string;
   2211         const HTTP2_HEADER_FROM: string;
   2212         const HTTP2_HEADER_HOST: string;
   2213         const HTTP2_HEADER_IF_MATCH: string;
   2214         const HTTP2_HEADER_IF_MODIFIED_SINCE: string;
   2215         const HTTP2_HEADER_IF_NONE_MATCH: string;
   2216         const HTTP2_HEADER_IF_RANGE: string;
   2217         const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string;
   2218         const HTTP2_HEADER_LAST_MODIFIED: string;
   2219         const HTTP2_HEADER_LINK: string;
   2220         const HTTP2_HEADER_LOCATION: string;
   2221         const HTTP2_HEADER_MAX_FORWARDS: string;
   2222         const HTTP2_HEADER_PREFER: string;
   2223         const HTTP2_HEADER_PROXY_AUTHENTICATE: string;
   2224         const HTTP2_HEADER_PROXY_AUTHORIZATION: string;
   2225         const HTTP2_HEADER_RANGE: string;
   2226         const HTTP2_HEADER_REFERER: string;
   2227         const HTTP2_HEADER_REFRESH: string;
   2228         const HTTP2_HEADER_RETRY_AFTER: string;
   2229         const HTTP2_HEADER_SERVER: string;
   2230         const HTTP2_HEADER_SET_COOKIE: string;
   2231         const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string;
   2232         const HTTP2_HEADER_TRANSFER_ENCODING: string;
   2233         const HTTP2_HEADER_TE: string;
   2234         const HTTP2_HEADER_UPGRADE: string;
   2235         const HTTP2_HEADER_USER_AGENT: string;
   2236         const HTTP2_HEADER_VARY: string;
   2237         const HTTP2_HEADER_VIA: string;
   2238         const HTTP2_HEADER_WWW_AUTHENTICATE: string;
   2239         const HTTP2_HEADER_HTTP2_SETTINGS: string;
   2240         const HTTP2_HEADER_KEEP_ALIVE: string;
   2241         const HTTP2_HEADER_PROXY_CONNECTION: string;
   2242         const HTTP2_METHOD_ACL: string;
   2243         const HTTP2_METHOD_BASELINE_CONTROL: string;
   2244         const HTTP2_METHOD_BIND: string;
   2245         const HTTP2_METHOD_CHECKIN: string;
   2246         const HTTP2_METHOD_CHECKOUT: string;
   2247         const HTTP2_METHOD_CONNECT: string;
   2248         const HTTP2_METHOD_COPY: string;
   2249         const HTTP2_METHOD_DELETE: string;
   2250         const HTTP2_METHOD_GET: string;
   2251         const HTTP2_METHOD_HEAD: string;
   2252         const HTTP2_METHOD_LABEL: string;
   2253         const HTTP2_METHOD_LINK: string;
   2254         const HTTP2_METHOD_LOCK: string;
   2255         const HTTP2_METHOD_MERGE: string;
   2256         const HTTP2_METHOD_MKACTIVITY: string;
   2257         const HTTP2_METHOD_MKCALENDAR: string;
   2258         const HTTP2_METHOD_MKCOL: string;
   2259         const HTTP2_METHOD_MKREDIRECTREF: string;
   2260         const HTTP2_METHOD_MKWORKSPACE: string;
   2261         const HTTP2_METHOD_MOVE: string;
   2262         const HTTP2_METHOD_OPTIONS: string;
   2263         const HTTP2_METHOD_ORDERPATCH: string;
   2264         const HTTP2_METHOD_PATCH: string;
   2265         const HTTP2_METHOD_POST: string;
   2266         const HTTP2_METHOD_PRI: string;
   2267         const HTTP2_METHOD_PROPFIND: string;
   2268         const HTTP2_METHOD_PROPPATCH: string;
   2269         const HTTP2_METHOD_PUT: string;
   2270         const HTTP2_METHOD_REBIND: string;
   2271         const HTTP2_METHOD_REPORT: string;
   2272         const HTTP2_METHOD_SEARCH: string;
   2273         const HTTP2_METHOD_TRACE: string;
   2274         const HTTP2_METHOD_UNBIND: string;
   2275         const HTTP2_METHOD_UNCHECKOUT: string;
   2276         const HTTP2_METHOD_UNLINK: string;
   2277         const HTTP2_METHOD_UNLOCK: string;
   2278         const HTTP2_METHOD_UPDATE: string;
   2279         const HTTP2_METHOD_UPDATEREDIRECTREF: string;
   2280         const HTTP2_METHOD_VERSION_CONTROL: string;
   2281         const HTTP_STATUS_CONTINUE: number;
   2282         const HTTP_STATUS_SWITCHING_PROTOCOLS: number;
   2283         const HTTP_STATUS_PROCESSING: number;
   2284         const HTTP_STATUS_OK: number;
   2285         const HTTP_STATUS_CREATED: number;
   2286         const HTTP_STATUS_ACCEPTED: number;
   2287         const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number;
   2288         const HTTP_STATUS_NO_CONTENT: number;
   2289         const HTTP_STATUS_RESET_CONTENT: number;
   2290         const HTTP_STATUS_PARTIAL_CONTENT: number;
   2291         const HTTP_STATUS_MULTI_STATUS: number;
   2292         const HTTP_STATUS_ALREADY_REPORTED: number;
   2293         const HTTP_STATUS_IM_USED: number;
   2294         const HTTP_STATUS_MULTIPLE_CHOICES: number;
   2295         const HTTP_STATUS_MOVED_PERMANENTLY: number;
   2296         const HTTP_STATUS_FOUND: number;
   2297         const HTTP_STATUS_SEE_OTHER: number;
   2298         const HTTP_STATUS_NOT_MODIFIED: number;
   2299         const HTTP_STATUS_USE_PROXY: number;
   2300         const HTTP_STATUS_TEMPORARY_REDIRECT: number;
   2301         const HTTP_STATUS_PERMANENT_REDIRECT: number;
   2302         const HTTP_STATUS_BAD_REQUEST: number;
   2303         const HTTP_STATUS_UNAUTHORIZED: number;
   2304         const HTTP_STATUS_PAYMENT_REQUIRED: number;
   2305         const HTTP_STATUS_FORBIDDEN: number;
   2306         const HTTP_STATUS_NOT_FOUND: number;
   2307         const HTTP_STATUS_METHOD_NOT_ALLOWED: number;
   2308         const HTTP_STATUS_NOT_ACCEPTABLE: number;
   2309         const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number;
   2310         const HTTP_STATUS_REQUEST_TIMEOUT: number;
   2311         const HTTP_STATUS_CONFLICT: number;
   2312         const HTTP_STATUS_GONE: number;
   2313         const HTTP_STATUS_LENGTH_REQUIRED: number;
   2314         const HTTP_STATUS_PRECONDITION_FAILED: number;
   2315         const HTTP_STATUS_PAYLOAD_TOO_LARGE: number;
   2316         const HTTP_STATUS_URI_TOO_LONG: number;
   2317         const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number;
   2318         const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number;
   2319         const HTTP_STATUS_EXPECTATION_FAILED: number;
   2320         const HTTP_STATUS_TEAPOT: number;
   2321         const HTTP_STATUS_MISDIRECTED_REQUEST: number;
   2322         const HTTP_STATUS_UNPROCESSABLE_ENTITY: number;
   2323         const HTTP_STATUS_LOCKED: number;
   2324         const HTTP_STATUS_FAILED_DEPENDENCY: number;
   2325         const HTTP_STATUS_UNORDERED_COLLECTION: number;
   2326         const HTTP_STATUS_UPGRADE_REQUIRED: number;
   2327         const HTTP_STATUS_PRECONDITION_REQUIRED: number;
   2328         const HTTP_STATUS_TOO_MANY_REQUESTS: number;
   2329         const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number;
   2330         const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number;
   2331         const HTTP_STATUS_INTERNAL_SERVER_ERROR: number;
   2332         const HTTP_STATUS_NOT_IMPLEMENTED: number;
   2333         const HTTP_STATUS_BAD_GATEWAY: number;
   2334         const HTTP_STATUS_SERVICE_UNAVAILABLE: number;
   2335         const HTTP_STATUS_GATEWAY_TIMEOUT: number;
   2336         const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number;
   2337         const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number;
   2338         const HTTP_STATUS_INSUFFICIENT_STORAGE: number;
   2339         const HTTP_STATUS_LOOP_DETECTED: number;
   2340         const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number;
   2341         const HTTP_STATUS_NOT_EXTENDED: number;
   2342         const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number;
   2343     }
   2344     /**
   2345      * This symbol can be set as a property on the HTTP/2 headers object with
   2346      * an array value in order to provide a list of headers considered sensitive.
   2347      */
   2348     export const sensitiveHeaders: symbol;
   2349     /**
   2350      * Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
   2351      * so instances returned may be safely modified for use.
   2352      * @since v8.4.0
   2353      */
   2354     export function getDefaultSettings(): Settings;
   2355     /**
   2356      * Returns a `Buffer` instance containing serialized representation of the given
   2357      * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended
   2358      * for use with the `HTTP2-Settings` header field.
   2359      *
   2360      * ```js
   2361      * import http2 from 'node:http2';
   2362      *
   2363      * const packed = http2.getPackedSettings({ enablePush: false });
   2364      *
   2365      * console.log(packed.toString('base64'));
   2366      * // Prints: AAIAAAAA
   2367      * ```
   2368      * @since v8.4.0
   2369      */
   2370     export function getPackedSettings(settings: Settings): Buffer;
   2371     /**
   2372      * Returns a `HTTP/2 Settings Object` containing the deserialized settings from
   2373      * the given `Buffer` as generated by `http2.getPackedSettings()`.
   2374      * @since v8.4.0
   2375      * @param buf The packed settings.
   2376      */
   2377     export function getUnpackedSettings(buf: Uint8Array): Settings;
   2378     /**
   2379      * Returns a `net.Server` instance that creates and manages `Http2Session` instances.
   2380      *
   2381      * 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
   2382      * communicating
   2383      * with browser clients.
   2384      *
   2385      * ```js
   2386      * import http2 from 'node:http2';
   2387      *
   2388      * // Create an unencrypted HTTP/2 server.
   2389      * // Since there are no browsers known that support
   2390      * // unencrypted HTTP/2, the use of `http2.createSecureServer()`
   2391      * // is necessary when communicating with browser clients.
   2392      * const server = http2.createServer();
   2393      *
   2394      * server.on('stream', (stream, headers) => {
   2395      *   stream.respond({
   2396      *     'content-type': 'text/html; charset=utf-8',
   2397      *     ':status': 200,
   2398      *   });
   2399      *   stream.end('<h1>Hello World</h1>');
   2400      * });
   2401      *
   2402      * server.listen(8000);
   2403      * ```
   2404      * @since v8.4.0
   2405      * @param onRequestHandler See `Compatibility API`
   2406      */
   2407     export function createServer(
   2408         onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
   2409     ): Http2Server;
   2410     export function createServer<
   2411         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   2412         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   2413         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   2414         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   2415     >(
   2416         options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
   2417         onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   2418     ): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>;
   2419     /**
   2420      * Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
   2421      *
   2422      * ```js
   2423      * import http2 from 'node:http2';
   2424      * import fs from 'node:fs';
   2425      *
   2426      * const options = {
   2427      *   key: fs.readFileSync('server-key.pem'),
   2428      *   cert: fs.readFileSync('server-cert.pem'),
   2429      * };
   2430      *
   2431      * // Create a secure HTTP/2 server
   2432      * const server = http2.createSecureServer(options);
   2433      *
   2434      * server.on('stream', (stream, headers) => {
   2435      *   stream.respond({
   2436      *     'content-type': 'text/html; charset=utf-8',
   2437      *     ':status': 200,
   2438      *   });
   2439      *   stream.end('<h1>Hello World</h1>');
   2440      * });
   2441      *
   2442      * server.listen(8443);
   2443      * ```
   2444      * @since v8.4.0
   2445      * @param onRequestHandler See `Compatibility API`
   2446      */
   2447     export function createSecureServer(
   2448         onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
   2449     ): Http2SecureServer;
   2450     export function createSecureServer<
   2451         Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
   2452         Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
   2453         Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
   2454         Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
   2455     >(
   2456         options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
   2457         onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
   2458     ): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
   2459     /**
   2460      * Returns a `ClientHttp2Session` instance.
   2461      *
   2462      * ```js
   2463      * import http2 from 'node:http2';
   2464      * const client = http2.connect('https://localhost:1234');
   2465      *
   2466      * // Use the client
   2467      *
   2468      * client.close();
   2469      * ```
   2470      * @since v8.4.0
   2471      * @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
   2472      * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.
   2473      * @param listener Will be registered as a one-time listener of the {@link 'connect'} event.
   2474      */
   2475     export function connect(
   2476         authority: string | url.URL,
   2477         listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
   2478     ): ClientHttp2Session;
   2479     export function connect(
   2480         authority: string | url.URL,
   2481         options?: ClientSessionOptions | SecureClientSessionOptions,
   2482         listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
   2483     ): ClientHttp2Session;
   2484 }
   2485 declare module "node:http2" {
   2486     export * from "http2";
   2487 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror