summaryrefslogtreecommitdiff
path: root/test/parallel/test-inspector-reported-host.js
diff options
context:
space:
mode:
authorEugene Ostroukhov <eostroukhov@google.com>2018-03-05 19:18:17 -0800
committerEugene Ostroukhov <eostroukhov@google.com>2018-04-02 10:20:30 -0700
commita9a1f12b4212c0ea81a04bf2eb56efe6f8a4699b (patch)
treeb2a5827e9285f40d1e056d603ad2bd2b1e3e3769 /test/parallel/test-inspector-reported-host.js
parent6de1a12e496b58b1ab1c150b3cee8a8d45040edb (diff)
downloadandroid-node-v8-a9a1f12b4212c0ea81a04bf2eb56efe6f8a4699b.tar.gz
android-node-v8-a9a1f12b4212c0ea81a04bf2eb56efe6f8a4699b.tar.bz2
android-node-v8-a9a1f12b4212c0ea81a04bf2eb56efe6f8a4699b.zip
inspector: report client-visible host and port
Node instance may not know the real host and port user sees when debug frontend connects through the SSH tunnel. This change fixes '/json/list' response by using the value client provided in the host header. PR-URL: https://github.com/nodejs/node/pull/19664 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'test/parallel/test-inspector-reported-host.js')
-rw-r--r--test/parallel/test-inspector-reported-host.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/parallel/test-inspector-reported-host.js b/test/parallel/test-inspector-reported-host.js
new file mode 100644
index 0000000000..f54ea16625
--- /dev/null
+++ b/test/parallel/test-inspector-reported-host.js
@@ -0,0 +1,22 @@
+// Flags: --expose-internals
+'use strict';
+const common = require('../common');
+
+common.skipIfInspectorDisabled();
+
+const assert = require('assert');
+const { NodeInstance } = require('../common/inspector-helper.js');
+
+common.crashOnUnhandledRejection();
+
+async function test() {
+ const madeUpHost = '111.111.111.111:11111';
+ const child = new NodeInstance(undefined, 'var a = 1');
+ const response = await child.httpGet(null, '/json', madeUpHost);
+ assert.ok(
+ response[0].webSocketDebuggerUrl.startsWith(`ws://${madeUpHost}`),
+ response[0].webSocketDebuggerUrl);
+ child.kill();
+}
+
+test();