Skip to content
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

[8.x] http2: expose http2 by default, add NODE_NO_HTTP2 #15685

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/http2/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PORT = common.PORT;
const bench = common.createBenchmark(main, {
n: [1e3],
nheaders: [0, 10, 100, 1000],
}, { flags: ['--expose-http2', '--no-warnings'] });
}, { flags: ['--no-warnings'] });

function main(conf) {
const n = +conf.n;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http2/respond-with-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, {
requests: [100, 1000, 10000, 100000, 1000000],
streams: [100, 200, 1000],
clients: [1, 2]
}, { flags: ['--expose-http2', '--no-warnings'] });
}, { flags: ['--no-warnings'] });

function main(conf) {

Expand Down
2 changes: 1 addition & 1 deletion benchmark/http2/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
requests: [100, 1000, 10000, 100000],
streams: [100, 200, 1000],
clients: [1, 2]
}, { flags: ['--expose-http2', '--no-warnings'] });
}, { flags: ['--no-warnings'] });

function main(conf) {
const n = +conf.requests;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http2/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
streams: [100, 200, 1000],
length: [64 * 1024, 128 * 1024, 256 * 1024, 1024 * 1024],
size: [100000]
}, { flags: ['--expose-http2', '--no-warnings'] });
}, { flags: ['--no-warnings'] });

function main(conf) {
const m = +conf.streams;
Expand Down
7 changes: 7 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,13 @@ added: v7.5.0

When set to `1`, process warnings are silenced.

### `NODE_NO_HTTP2=1`
<!-- YAML
added: REPLACEME
-->

When set to `1`, the `http2` module is suppressed.

### `NODE_OPTIONS=options...`
<!-- YAML
added: v8.0.0
Expand Down
3 changes: 0 additions & 3 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ can be accessed using:
const http2 = require('http2');
```

*Note*: Node.js must be launched with the `--expose-http2` command line flag
in order to use the `'http2'` module.
Copy link
Member

Choose a reason for hiding this comment

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

I think this might still be useful as information in a YAML changes: entry?


## Core API

The Core API provides a low-level interface designed specifically around
Expand Down
8 changes: 4 additions & 4 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ Emit pending deprecation warnings.
.BR \-\-no\-warnings
Silence all process warnings (including deprecations).

.TP
.BR \-\-expose\-http2
Enable the experimental `'http2'` module.

.TP
.BR \-\-napi\-modules
Enable loading native modules compiled with the ABI-stable Node.js API (N-API)
Expand Down Expand Up @@ -280,6 +276,10 @@ with small\-icu support.
.BR NODE_NO_WARNINGS =\fI1\fR
When set to \fI1\fR, process warnings are silenced.

.TP
.BR NODE_NO_HTTP2 =\fI1\fR
When set to \fI1\fR, the http2 module is suppressed.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/supressed/not included in the runtime?

Not 100% that "supressed" gets the message across

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: the 'http2' module is not exposed by the runtime
If decided to change should mirror in doc/api/cli.md:440 and src/node.cc:3832


.TP
.BR NODE_OPTIONS =\fIoptions...\fR
A space-separated list of command line options. \fBoptions...\fR are interpreted
Expand Down
16 changes: 11 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ std::string config_warning_file; // NOLINT(runtime/string)
// that is used by lib/internal/bootstrap_node.js
bool config_expose_internals = false;

// Set in node.cc by ParseArgs when --expose-http2 is used.
bool config_expose_http2 = false;
// Set to false in node.cc when NODE_NO_HTTP2=1 is used.
bool config_expose_http2 = true;

bool v8_initialized = false;

Expand Down Expand Up @@ -3830,7 +3830,6 @@ static void PrintHelp() {
" --abort-on-uncaught-exception\n"
" aborting instead of exiting causes a\n"
" core file to be generated for analysis\n"
" --expose-http2 enable experimental HTTP2 support\n"
" --trace-warnings show stack traces on process warnings\n"
" --redirect-warnings=file\n"
" write warnings to file instead of\n"
Expand Down Expand Up @@ -3894,7 +3893,8 @@ static void PrintHelp() {
#endif
#endif
"NODE_NO_WARNINGS set to 1 to silence process warnings\n"
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
"NODE_NO_HTTP2 set to 1 to suppress the http2 module\n"
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
"NODE_OPTIONS set CLI options in the environment\n"
" via a space-separated list\n"
#endif
Expand Down Expand Up @@ -4173,7 +4173,7 @@ static void ParseArgs(int* argc,
config_expose_internals = true;
} else if (strcmp(arg, "--expose-http2") == 0 ||
strcmp(arg, "--expose_http2") == 0) {
config_expose_http2 = true;
// Intentional non-op
} else if (strcmp(arg, "-") == 0) {
break;
} else if (strcmp(arg, "--") == 0) {
Expand Down Expand Up @@ -4550,6 +4550,12 @@ void Init(int* argc,
SafeGetenv("NODE_PENDING_DEPRECATION", &text) && text[0] == '1';
}

{
std::string text;
config_expose_http2 =
!(SafeGetenv("NODE_NO_HTTP2", &text) && text[0] == '1');
Copy link
Member

Choose a reason for hiding this comment

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

I think we had a similar discussion like this, but this would currently make a distinction between NODE_NO_HTTP2=19 and NODE_NO_HTTP2=20. Why not just … && text == "1"?

}

// Allow for environment set preserving symlinks.
{
std::string text;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-binding.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-data-end.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-destroy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-onconnect-errors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-priority-before-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-promisify-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-request-options-errors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-set-priority.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-settings-before-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-shutdown-before-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-socket-destroy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-unescaped-path.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-upload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

// Verifies that uploading data from a client works
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-client-write-before-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-compat-errors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-http2 --expose-internals
// Flags: --expose-internals
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-expect-continue-check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-expect-continue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-expect-handling.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-method-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverrequest-end.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverrequest-headers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverrequest-pause.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverrequest-pipe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverrequest-trailers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverrequest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-compat-serverresponse-close.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-http2 --expose-internals
// Flags: --expose-internals
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverresponse-destroy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverresponse-drain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverresponse-end.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverresponse-finished.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverresponse-headers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-compat-serverresponse-trailers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const { mustCall,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-connect-method.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const { mustCall, hasCrypto, skip, expectsError } = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-cookies.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-create-client-connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

// Tests http2.connect()
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-create-client-secure-session.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-create-client-session.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-createsecureserver-nooptions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --expose-http2
'use strict';

const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-createwritereq.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-http2
//
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason the comment remains?

'use strict';

const common = require('../common');
Expand Down
Loading