Skip to content

Commit

Permalink
http2: make --expose-http2 flag a non-op
Browse files Browse the repository at this point in the history
Make the `http2` module always available.
The `--expose-http2` cli flag is made a non-op

PR-URL: nodejs/node#15535
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
jasnell authored and addaleax committed Sep 30, 2017
1 parent 8f5c58a commit 0dea1fb
Show file tree
Hide file tree
Showing 142 changed files with 12 additions and 174 deletions.
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 @@ -6,7 +6,7 @@ const PORT = common.PORT;
const bench = common.createBenchmark(main, {
streams: [100, 200, 1000],
length: [64 * 1024, 128 * 1024, 256 * 1024, 1024 * 1024],
}, { flags: ['--expose-http2', '--no-warnings'] });
}, { flags: ['--no-warnings'] });

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

Silence all process warnings (including deprecations).

### `--expose-http2`
<!-- YAML
added: v8.4.0
-->

Enable the experimental `'http2'` module.

### `--abort-on-uncaught-exception`
<!-- YAML
added: v0.10
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.

## Core API

The Core API provides a low-level interface designed specifically around
Expand Down
4 changes: 0 additions & 4 deletions doc/ayo.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
3 changes: 0 additions & 3 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,6 @@

const config = process.binding('config');

if (!config.exposeHTTP2)
delete NativeModule._source.http2;

NativeModule.require = function(id) {
if (id === 'native_module') {
return NativeModule;
Expand Down
6 changes: 1 addition & 5 deletions lib/internal/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,11 @@ function stripShebang(content) {

const builtinLibs = [
'assert', 'async_hooks', 'buffer', 'child_process', 'cluster', 'crypto',
'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net',
'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'http2', 'https', 'net',
'os', 'path', 'perf_hooks', 'punycode', 'querystring', 'readline', 'repl',
'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'
];

const { exposeHTTP2 } = process.binding('config');
if (exposeHTTP2)
builtinLibs.push('http2');

function addBuiltinLibsToObject(object) {
// Make built-in modules available directly (loaded lazily).
builtinLibs.forEach((name) => {
Expand Down
8 changes: 2 additions & 6 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,6 @@ 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;

bool v8_initialized = false;

bool linux_at_secure = false;
Expand Down Expand Up @@ -3829,7 +3826,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 @@ -3953,7 +3949,7 @@ static void CheckIfAllowedInEnv(const char* exe, bool is_env,
"--pending-deprecation",
"--no-warnings",
"--napi-modules",
"--expose-http2",
"--expose-http2", // keep as a non-op through v9.x
"--trace-warnings",
"--redirect-warnings",
"--trace-sync-io",
Expand Down Expand Up @@ -4155,7 +4151,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;
// Keep as a non-op through v9.x
} else if (strcmp(arg, "-") == 0) {
break;
} else if (strcmp(arg, "--") == 0) {
Expand Down
3 changes: 0 additions & 3 deletions src/node_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ static void InitConfig(Local<Object> target,
if (config_expose_internals)
READONLY_BOOLEAN_PROPERTY("exposeInternals");

if (config_expose_http2)
READONLY_BOOLEAN_PROPERTY("exposeHTTP2");

READONLY_PROPERTY(target,
"bits",
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
Expand Down
2 changes: 0 additions & 2 deletions src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ extern std::string openssl_config;
// that is used by lib/module.js
extern bool config_preserve_symlinks;

// Set in node.cc by ParseArgs when --expose-http2 is used.
extern bool config_expose_http2;
// Set in node.cc by ParseArgs when --experimental-modules is used.
// Used in node_config.cc to set a constant on process.binding('config')
// that is used by lib/module.js
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-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-destroy-before-request.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-goaway.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 { mustCall, mustNotCall, hasCrypto, skip } = require('../common');
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
Loading

0 comments on commit 0dea1fb

Please sign in to comment.