Skip to content

Commit 57ab6e2

Browse files
jasnellevanlucas
authored andcommittedOct 23, 2017
http2: expose http2 by default, add NODE_NO_HTTP2
Make `--expose-http2` a non-op, Expose http2 by default. Add `NODE_NO_HTTP2=1` to suppress http2 PR-URL: #15685 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
1 parent e34509e commit 57ab6e2

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed
 

‎doc/api/cli.md

+7
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,13 @@ added: v7.5.0
432432

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

435+
### `NODE_NO_HTTP2=1`
436+
<!-- YAML
437+
added: REPLACEME
438+
-->
439+
440+
When set to `1`, the `http2` module is suppressed.
441+
435442
### `NODE_OPTIONS=options...`
436443
<!-- YAML
437444
added: v8.0.0

‎doc/api/http2.md

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ can be accessed using:
99
const http2 = require('http2');
1010
```
1111

12-
*Note*: Node.js must be launched with the `--expose-http2` command line flag
13-
in order to use the `'http2'` module.
14-
1512
## Core API
1613

1714
The Core API provides a low-level interface designed specifically around

‎doc/node.1

+4-4
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ Emit pending deprecation warnings.
130130
.BR \-\-no\-warnings
131131
Silence all process warnings (including deprecations).
132132

133-
.TP
134-
.BR \-\-expose\-http2
135-
Enable the experimental `'http2'` module.
136-
137133
.TP
138134
.BR \-\-napi\-modules
139135
Enable loading native modules compiled with the ABI-stable Node.js API (N-API)
@@ -280,6 +276,10 @@ with small\-icu support.
280276
.BR NODE_NO_WARNINGS =\fI1\fR
281277
When set to \fI1\fR, process warnings are silenced.
282278

279+
.TP
280+
.BR NODE_NO_HTTP2 =\fI1\fR
281+
When set to \fI1\fR, the http2 module is suppressed.
282+
283283
.TP
284284
.BR NODE_OPTIONS =\fIoptions...\fR
285285
A space-separated list of command line options. \fBoptions...\fR are interpreted

‎src/node.cc

+11-5
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ std::string config_warning_file; // NOLINT(runtime/string)
246246
// that is used by lib/internal/bootstrap_node.js
247247
bool config_expose_internals = false;
248248

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

252252
bool v8_initialized = false;
253253

@@ -3830,7 +3830,6 @@ static void PrintHelp() {
38303830
" --abort-on-uncaught-exception\n"
38313831
" aborting instead of exiting causes a\n"
38323832
" core file to be generated for analysis\n"
3833-
" --expose-http2 enable experimental HTTP2 support\n"
38343833
" --trace-warnings show stack traces on process warnings\n"
38353834
" --redirect-warnings=file\n"
38363835
" write warnings to file instead of\n"
@@ -3894,7 +3893,8 @@ static void PrintHelp() {
38943893
#endif
38953894
#endif
38963895
"NODE_NO_WARNINGS set to 1 to silence process warnings\n"
3897-
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
3896+
"NODE_NO_HTTP2 set to 1 to suppress the http2 module\n"
3897+
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
38983898
"NODE_OPTIONS set CLI options in the environment\n"
38993899
" via a space-separated list\n"
39003900
#endif
@@ -4173,7 +4173,7 @@ static void ParseArgs(int* argc,
41734173
config_expose_internals = true;
41744174
} else if (strcmp(arg, "--expose-http2") == 0 ||
41754175
strcmp(arg, "--expose_http2") == 0) {
4176-
config_expose_http2 = true;
4176+
// Intentional non-op
41774177
} else if (strcmp(arg, "-") == 0) {
41784178
break;
41794179
} else if (strcmp(arg, "--") == 0) {
@@ -4550,6 +4550,12 @@ void Init(int* argc,
45504550
SafeGetenv("NODE_PENDING_DEPRECATION", &text) && text[0] == '1';
45514551
}
45524552

4553+
{
4554+
std::string text;
4555+
config_expose_http2 =
4556+
!(SafeGetenv("NODE_NO_HTTP2", &text) && text[0] == '1');
4557+
}
4558+
45534559
// Allow for environment set preserving symlinks.
45544560
{
45554561
std::string text;

0 commit comments

Comments
 (0)
Please sign in to comment.