From eb2643c7b2e71d5e876ed6cf66df68cd30b1ab29 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sun, 12 Jul 2026 19:12:55 +0000 Subject: [PATCH] lib: deprecate _http_* Signed-off-by: Sebastian Beltran --- .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 | 674 +------- lib/_http_client.js | 1247 +------------- lib/_http_common.js | 331 +--- lib/_http_incoming.js | 452 +---- lib/_http_outgoing.js | 1240 +------------- lib/_http_server.js | 1438 +--------------- lib/http.js | 12 +- lib/https.js | 6 +- lib/internal/child_process.js | 4 +- lib/internal/http/agent.js | 696 ++++++++ lib/internal/http/client.js | 1270 ++++++++++++++ lib/internal/http/common.js | 345 ++++ lib/internal/http/incoming.js | 477 ++++++ lib/internal/http/outgoing.js | 1263 ++++++++++++++ lib/internal/http/server.js | 1460 +++++++++++++++++ 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 +- .../test-http-header-value-relaxed.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 +- 51 files changed, 5712 insertions(+), 5366 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 22fef9e8c2201e..bb9515fe8d38aa 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 2109fbe54f93ea..b3be6a1812e542 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -4381,6 +4381,9 @@ Creating SHAKE-128 and SHAKE-256 digests without an explicit