From f8c9a58bf5752114a43b0778c1d5ef780301177f Mon Sep 17 00:00:00 2001 From: Aleksei Koziatinskii Date: Thu, 16 May 2019 15:33:09 -0700 Subject: [PATCH] inspector: added --inspect-publish-uid This flag specifies how inspector websocket url should be reported. Tthre options are supported: - stderr - reports websocket as a message to stderr, - http - exposes /json/list endpoint that contains inspector websocket url, - binding - require('inspector').url(). Related discussion: https://github.com/nodejs/diagnostics/issues/303 PR-URL: https://github.com/nodejs/node/pull/27741 Reviewed-By: Eugene Ostroukhov Reviewed-By: Benjamin Gruenbaum --- doc/api/cli.md | 8 +++ src/inspector_agent.cc | 5 +- src/inspector_io.cc | 15 ++++-- src/inspector_io.h | 7 ++- src/inspector_socket_server.cc | 55 +++++++++++++++------ src/inspector_socket_server.h | 2 + src/node_options.cc | 21 ++++++++ src/node_options.h | 9 ++++ test/cctest/test_inspector_socket_server.cc | 6 ++- test/parallel/test-inspect-publish-uid.js | 42 ++++++++++++++++ 10 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 test/parallel/test-inspect-publish-uid.js diff --git a/doc/api/cli.md b/doc/api/cli.md index e6e507ddb6c5c5..f3accc0c29f130 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -400,6 +400,13 @@ default) is not firewall-protected.** See the [debugging security implications][] section for more information. +### `--inspect-publish-uid=stderr,http` + +Specify ways of the inspector web socket url exposure. + +By default inspector websocket url is available in stderr and under `/json/list` +endpoint on `http://host:port/json/list`. + ### `--loader=file`