Skip to content

lib: deprecate _http_* #58535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

bjohansebas
Copy link
Member

close #58534

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels May 31, 2025
@bjohansebas bjohansebas added the wip Issues and PRs that are still a work in progress. label May 31, 2025
@bjohansebas bjohansebas force-pushed the http_internals branch 2 times, most recently from 11b6878 to 329d0a0 Compare May 31, 2025 20:17
@bjohansebas bjohansebas added semver-major PRs that contain breaking changes and should be released in the next major version. deprecations Issues and PRs related to deprecations. labels May 31, 2025
@bjohansebas bjohansebas marked this pull request as ready for review May 31, 2025 21:29
@bjohansebas bjohansebas removed the wip Issues and PRs that are still a work in progress. label May 31, 2025
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
// TODO: benchmark has access to internal modules?
const _checkIsHttpToken = require('_http_common')._checkIsHttpToken;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't really considered internal modules, fwiw

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that property is not under the http module, so when _http_common stops being a module and becomes internal-only, the benchmark won’t work. That’s why I was asking if it's possible to use internals in the benchmarks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I imagine that the require was supposed to be updated to internal/http/common?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern would be whether or not anyone in userland could be using this, as unlikely as that may be. Should we export this through the regular node:http API to provide an alternative path to them?

@jasnell
Copy link
Member

jasnell commented May 31, 2025

@nodejs/http @mcollina

@jasnell
Copy link
Member

jasnell commented May 31, 2025

This one might need a Documentation-only deprecation to start. It's likely going to be too disruptive to go straight to a Runtime deprecation. https://github.com/search?type=code&q=%22require%28%27_http%22

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! thanks for doing this! 🫶

(with this all pesky _modules will be runtime deprecated! 💪)

@@ -1,3 +1,4 @@
// Flags: --expose-internals --no-warnings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the addition of --no-warning? here and in the other tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only saw it in other tests, I thought it was necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this and I must say that I find it very weird.... I went and checked existing--no-warning I cannot really understand why they are there, since the test script suppresses outputs anyways, I totally cannot see any difference when I try to remove them... 🤷

@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
// TODO: benchmark has access to internal modules?
const _checkIsHttpToken = require('_http_common')._checkIsHttpToken;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I imagine that the require was supposed to be updated to internal/http/common?

@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
// TODO: benchmark has access to internal modules?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the require be updated to internal/http/common? 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but I’m not really sure if the benchmark has access to the internals or not :)

Copy link
Member

@dario-piotrowicz dario-piotrowicz Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah no.... the benchmarks, as far as I understand it, should be runnable with any build of node, so yeah that's a good point, I don't think it's correct to have a benchmark access internal modules

@bjohansebas
Copy link
Member Author

This one might need a Documentation-only deprecation to start. It's likely going to be too disruptive to go straight to a Runtime deprecation. https://github.com/search?type=code&q=%22require%28%27_http%22

Most of them seem to be just forks of Node.js, rather than actually using these undocumented modules.

@jasnell
Copy link
Member

jasnell commented May 31, 2025

Most of them seem to be just forks of Node.js....

I wish that were the case. While there are a good number of forks in those search results, it's plain to see that there are a non-trivial number of other projects requiring "_http_common" and friends. We need to assess just how disruptive this will be... but don't get me wrong, I am in favor of deprecated these but it might need to be a slower path. I'd like @nodejs/http folks to weigh in.

Copy link

codecov bot commented Jun 1, 2025

Codecov Report

Attention: Patch coverage is 97.49006% with 120 lines in your changes missing coverage. Please review.

Project coverage is 90.25%. Comparing base (f497881) to head (2103d6f).
Report is 105 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/http/outgoing.js 95.76% 48 Missing and 3 partials ⚠️
lib/internal/http/server.js 97.07% 33 Missing and 3 partials ⚠️
lib/internal/http/client.js 97.99% 20 Missing ⚠️
lib/internal/http/agent.js 98.17% 10 Missing ⚠️
lib/internal/http/incoming.js 99.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58535      +/-   ##
==========================================
+ Coverage   90.23%   90.25%   +0.01%     
==========================================
  Files         635      641       +6     
  Lines      187580   187832     +252     
  Branches    36860    36862       +2     
==========================================
+ Hits       169265   169520     +255     
+ Misses      11101    11095       -6     
- Partials     7214     7217       +3     
Files with missing lines Coverage Δ
lib/_http_agent.js 100.00% <100.00%> (+1.82%) ⬆️
lib/_http_client.js 100.00% <100.00%> (+2.00%) ⬆️
lib/_http_common.js 100.00% <100.00%> (ø)
lib/_http_incoming.js 100.00% <100.00%> (+0.66%) ⬆️
lib/_http_outgoing.js 100.00% <100.00%> (+4.23%) ⬆️
lib/_http_server.js 100.00% <100.00%> (+3.16%) ⬆️
lib/http.js 100.00% <100.00%> (ø)
lib/https.js 99.30% <100.00%> (ø)
lib/internal/child_process.js 95.06% <100.00%> (ø)
lib/internal/http/common.js 100.00% <100.00%> (ø)
... and 8 more

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
// TODO: benchmark has access to internal modules?
Copy link
Member

@dario-piotrowicz dario-piotrowicz Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah no.... the benchmarks, as far as I understand it, should be runnable with any build of node, so yeah that's a good point, I don't think it's correct to have a benchmark access internal modules

_checkIsHttpToken,
chunkExpression,
continueExpression,
CRLF, // TODO: Deprecate this.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CRLF, // TODO: Deprecate this.
CRLF,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to have a deprecate todo inside a deprecated module right? (and I don't think this is re-exported by the public http module, right?)

@@ -1,3 +1,4 @@
// Flags: --expose-internals --no-warnings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this and I must say that I find it very weird.... I went and checked existing--no-warning I cannot really understand why they are there, since the test script suppresses outputs anyways, I totally cannot see any difference when I try to remove them... 🤷

@bjohansebas
Copy link
Member Author

@nodejs/http what are your recommendations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecations Issues and PRs related to deprecations. http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move _http_* to be internal APIs.
4 participants