From 61770392306ea33e0f43c30fe22ff1eee0f7dee4 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sun, 19 Apr 2026 21:17:48 +0000 Subject: [PATCH] lib: deprecate _http_* --- .github/CODEOWNERS | 1 + benchmark/http/check_invalid_header_char.js | 7 +- benchmark/http/check_is_http_token.js | 7 +- benchmark/http/set_header.js | 2 +- doc/api/deprecations.md | 3 + lib/_http_agent.js | 609 +------ lib/_http_client.js | 1068 +------------ lib/_http_common.js | 303 +--- lib/_http_incoming.js | 460 +----- lib/_http_outgoing.js | 1188 +------------- lib/_http_server.js | 1376 +--------------- lib/http.js | 12 +- lib/https.js | 6 +- lib/internal/child_process.js | 4 +- lib/internal/http/agent.js | 631 ++++++++ lib/internal/http/client.js | 1091 +++++++++++++ lib/internal/http/common.js | 317 ++++ lib/internal/http/incoming.js | 485 ++++++ lib/internal/http/outgoing.js | 1211 ++++++++++++++ lib/internal/http/server.js | 1398 +++++++++++++++++ lib/internal/http2/compat.js | 3 +- lib/internal/http2/core.js | 2 +- lib/internal/http2/util.js | 2 +- test/async-hooks/test-httpparser.request.js | 4 +- test/async-hooks/test-httpparser.response.js | 4 +- ...st-async-local-storage-http-parser-leak.js | 5 +- .../test-http-agent-keepalive-delay.js | 2 +- test/parallel/test-http-agent-keepalive.js | 2 +- test/parallel/test-http-common.js | 4 +- .../parallel/test-http-invalidheaderfield2.js | 4 +- test/parallel/test-http-parser-bad-ref.js | 4 +- test/parallel/test-http-parser-lazy-loaded.js | 2 +- .../test-http-parser-memory-retention.js | 3 +- test/parallel/test-http-parser.js | 4 +- .../test-http-server-async-dispose.js | 4 +- test/parallel/test-http-server-clear-timer.js | 4 +- .../test-http-server-close-destroy-timeout.js | 5 +- .../test-http-server-options-highwatermark.js | 2 +- .../test-http-set-max-idle-http-parser.js | 4 +- .../test-https-server-async-dispose.js | 3 +- ...test-https-server-close-destroy-timeout.js | 3 +- test/parallel/test-outgoing-message-pipe.js | 2 +- .../test-warn-http-agent-deprecation.js | 10 + .../test-warn-http-client-deprecation.js | 10 + .../test-warn-http-common-deprecation.js | 10 + .../test-warn-http-incoming-deprecation.js | 10 + .../test-warn-http-outgoing-deprecation.js | 10 + .../test-warn-http-server-deprecation.js | 10 + test/sequential/test-async-wrap-getasyncid.js | 2 +- test/sequential/test-http-regr-gh-2928.js | 5 +- 50 files changed, 5330 insertions(+), 4988 deletions(-) create mode 100644 lib/internal/http/agent.js create mode 100644 lib/internal/http/client.js create mode 100644 lib/internal/http/common.js create mode 100644 lib/internal/http/incoming.js create mode 100644 lib/internal/http/outgoing.js create mode 100644 lib/internal/http/server.js create mode 100644 test/parallel/test-warn-http-agent-deprecation.js create mode 100644 test/parallel/test-warn-http-client-deprecation.js create mode 100644 test/parallel/test-warn-http-common-deprecation.js create mode 100644 test/parallel/test-warn-http-incoming-deprecation.js create mode 100644 test/parallel/test-warn-http-outgoing-deprecation.js create mode 100644 test/parallel/test-warn-http-server-deprecation.js diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 34b54a52ab4b5c..9c2f51554d9008 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -73,6 +73,7 @@ /lib/https.js @nodejs/crypto @nodejs/net @nodejs/http /src/node_http_common* @nodejs/http @nodejs/http2 @nodejs/net /src/node_http_parser.cc @nodejs/http @nodejs/net +/lib/internal/http/* @nodejs/http @nodejs/net # http2 diff --git a/benchmark/http/check_invalid_header_char.js b/benchmark/http/check_invalid_header_char.js index bd250cd5fe0206..5d1ffe74e583a2 100644 --- a/benchmark/http/check_invalid_header_char.js +++ b/benchmark/http/check_invalid_header_char.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common.js'); -const _checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar; const groupedInputs = { // Representative set of inputs from an AcmeAir benchmark run: @@ -51,9 +50,13 @@ const inputs = [ const bench = common.createBenchmark(main, { input: inputs.concat(Object.keys(groupedInputs)), n: [1e6], +}, { + flags: ['--expose-internals', '--no-warnings'], }); function main({ n, input }) { + const checkInvalidHeaderChar = require('internal/http/common')._checkInvalidHeaderChar; + let inputs = [input]; if (Object.hasOwn(groupedInputs, input)) { inputs = groupedInputs[input]; @@ -62,7 +65,7 @@ function main({ n, input }) { const len = inputs.length; bench.start(); for (let i = 0; i < n; i++) { - _checkInvalidHeaderChar(inputs[i % len]); + checkInvalidHeaderChar(inputs[i % len]); } bench.end(n); } diff --git a/benchmark/http/check_is_http_token.js b/benchmark/http/check_is_http_token.js index 2137a73e547d60..553608571aa554 100644 --- a/benchmark/http/check_is_http_token.js +++ b/benchmark/http/check_is_http_token.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common.js'); -const _checkIsHttpToken = require('_http_common')._checkIsHttpToken; const bench = common.createBenchmark(main, { key: [ @@ -38,12 +37,16 @@ const bench = common.createBenchmark(main, { 'alternate-protocol:', // slow bailout ], n: [1e6], +}, { + flags: ['--expose-internals', '--no-warnings'], }); function main({ n, key }) { + const checkIsHttpToken = require('internal/http/common')._checkIsHttpToken; + bench.start(); for (let i = 0; i < n; i++) { - _checkIsHttpToken(key); + checkIsHttpToken(key); } bench.end(n); } diff --git a/benchmark/http/set_header.js b/benchmark/http/set_header.js index f2236696f1c7df..0938c1e9cc2198 100644 --- a/benchmark/http/set_header.js +++ b/benchmark/http/set_header.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common.js'); -const { OutgoingMessage } = require('_http_outgoing'); +const { OutgoingMessage } = require('http'); const bench = common.createBenchmark(main, { value: [ diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index e4e05caa916b6a..f04875e1e78053 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -4368,6 +4368,9 @@ Creating SHAKE-128 and SHAKE-256 digests without an explicit `options.outputLeng