UNPKG

2.06 kBTypeScriptView Raw
1import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http";
2import { HttpHandlerOptions, Provider } 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 config?;
28 private readonly configProvider;
29 readonly metadata: {
30 handlerProtocol: string;
31 };
32 private sessionCache;
33 constructor(options?: NodeHttp2HandlerOptions | Provider<NodeHttp2HandlerOptions | void>);
34 destroy(): void;
35 handle(request: HttpRequest, { abortSignal }?: HttpHandlerOptions): Promise<{
36 response: HttpResponse;
37 }>;
38 /**
39 * Returns a session for the given URL.
40 *
41 * @param authority The URL to create a session for.
42 * @param disableConcurrentStreams If true, a new session will be created for each request.
43 * @returns A session for the given URL.
44 */
45 private getSession;
46 /**
47 * Destroys a session.
48 * @param session The session to destroy.
49 */
50 private destroySession;
51 /**
52 * Delete a session from the connection pool.
53 * @param authority The authority of the session to delete.
54 * @param session The session to delete.
55 */
56 private deleteSessionFromCache;
57}