UNPKG

2.13 kBTypeScriptView Raw
1import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http";
2import { HttpHandlerOptions } from "@aws-sdk/types";
3/**
4 * Represents the http2 options that can be passed to a node http2 client.
5 */
6export interface NodeHttp2HandlerOptions {
7 /**
8 * The maximum time in milliseconds that a stream may remain idle before it
9 * is closed.
10 */
11 requestTimeout?: number;
12 /**
13 * The maximum time in milliseconds that a session or socket may remain idle
14 * before it is closed.
15 * https://nodejs.org/docs/latest-v12.x/api/http2.html#http2_http2session_and_sockets
16 */
17 sessionTimeout?: number;
18 /**
19 * Disables processing concurrent streams on a ClientHttp2Session instance. When set
20 * to true, the handler will create a new session instance for each request to a URL.
21 * **Default:** false.
22 * https://nodejs.org/api/http2.html#http2_class_clienthttp2session
23 */
24 disableConcurrentStreams?: boolean;
25}
26export declare class NodeHttp2Handler implements HttpHandler {
27 private readonly requestTimeout?;
28 private readonly sessionTimeout?;
29 private readonly disableConcurrentStreams?;
30 readonly metadata: {
31 handlerProtocol: string;
32 };
33 private sessionCache;
34 constructor({ requestTimeout, sessionTimeout, disableConcurrentStreams }?: NodeHttp2HandlerOptions);
35 destroy(): void;
36 handle(request: HttpRequest, { abortSignal }?: HttpHandlerOptions): Promise<{
37 response: HttpResponse;
38 }>;
39 /**
40 * Returns a session for the given URL.
41 *
42 * @param authority The URL to create a session for.
43 * @param disableConcurrentStreams If true, a new session will be created for each request.
44 * @returns A session for the given URL.
45 */
46 private getSession;
47 /**
48 * Destroys a session.
49 * @param session The session to destroy.
50 */
51 private destroySession;
52 /**
53 * Delete a session from the connection pool.
54 * @param authority The authority of the session to delete.
55 * @param session The session to delete.
56 */
57 private deleteSessionFromCache;
58}