From f00aa2b2666f5b3e1ed1027c1fec874c9a577e3f 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 78268b2b666138..cb8562b1d7ec87 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -4415,6 +4415,42 @@ import { opendir } from 'node:fs/promises'; } ``` +### 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 @@ -4493,6 +4529,8 @@ import { opendir } from 'node:fs/promises'; [`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.