From b53d8f5b6cd689976a8de546340e0a28bff25d5a Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Fri, 15 Dec 2023 21:11:42 -0800 Subject: [PATCH] http2: add server handshake utility --- doc/api/http2.md | 13 +++++ lib/http2.js | 2 + lib/internal/http2/core.js | 20 +++++--- lib/internal/js_stream_socket.js | 9 ++++ .../test-http2-perform-server-handshake.js | 48 +++++++++++++++++++ 5 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 test/parallel/test-http2-perform-server-handshake.js diff --git a/doc/api/http2.md b/doc/api/http2.md index c45e5142ca753c..8c539819f2a748 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2875,6 +2875,19 @@ added: v8.4.0 Returns a [HTTP/2 Settings Object][] containing the deserialized settings from the given `Buffer` as generated by `http2.getPackedSettings()`. +### `http2.performServerHandshake(socket[, options])` + + + +* `socket` {stream.Duplex} +* `options` {Object} + * ...: Any [`http2.createServer()`][] option can be provided. +* Returns: {ServerHttp2Session} + +Create an HTTP/2 server session from an existing socket. + ### `http2.sensitiveHeaders`