From 0216ca9e5624259bb6ea3664f4abc1d0102f1203 Mon Sep 17 00:00:00 2001 From: Amol Yadav Date: Wed, 11 Feb 2026 09:10:08 +0530 Subject: [PATCH] http2: add http1Options for HTTP/1 fallback configuration --- doc/api/deprecations.md | 38 +++++++++++++++++ doc/api/http2.md | 41 +++++++++++++++++++ lib/internal/http2/core.js | 29 ++++++++----- ...ttp2-https-fallback-http-server-options.js | 11 ++++- 4 files changed, 107 insertions(+), 12 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index bb8ca3e63e0096..b47a17bd747d97 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -4430,6 +4430,42 @@ Passing the `type` option to [`Duplex.toWeb()`][] is deprecated. To specify the type of the readable half of the constructed readable-writable pair, use the `readableType` option instead. +### DEP0202: `Http1IncomingMessage` and `Http1ServerResponse` options of HTTP/2 servers + + + +Type: Documentation-only + +The `Http1IncomingMessage` and `Http1ServerResponse` options of +[`http2.createServer()`][] and [`http2.createSecureServer()`][] are +deprecated. Use `http1Options.IncomingMessage` and +`http1Options.ServerResponse` instead. + +```cjs +// Deprecated +const server = http2.createSecureServer({ + allowHTTP1: true, + Http1IncomingMessage: MyIncomingMessage, + Http1ServerResponse: MyServerResponse, +}); +``` + +```cjs +// Use this instead +const server = http2.createSecureServer({ + allowHTTP1: true, + http1Options: { + IncomingMessage: MyIncomingMessage, + ServerResponse: MyServerResponse, + }, +}); +``` + [DEP0142]: #dep0142-repl_builtinlibs [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 @@ -4509,6 +4545,8 @@ type of the readable half of the constructed readable-writable pair, use the [`http.ServerResponse`]: http.md#class-httpserverresponse [`http.get()`]: http.md#httpgetoptions-callback [`http.request()`]: http.md#httprequestoptions-callback +[`http2.createSecureServer()`]: http2.md#http2createsecureserveroptions-onrequesthandler +[`http2.createServer()`]: http2.md#http2createserveroptions-onrequesthandler [`https.get()`]: https.md#httpsgetoptions-callback [`https.request()`]: https.md#httpsrequestoptions-callback [`message.connection`]: http.md#messageconnection diff --git a/doc/api/http2.md b/doc/api/http2.md index 62a213f145d80e..4663c7400b3730 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2796,6 +2796,10 @@ Throws `ERR_INVALID_ARG_TYPE` for invalid `settings` argument.