From cf5a00e904be66084cf707ec9322503eed13b610 Mon Sep 17 00:00:00 2001 From: Eugene Ostroukhov Date: Thu, 3 Nov 2016 14:28:08 -0700 Subject: [PATCH] inspector: do not prompt to use localhost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are multiple reports of Windows7 not being able to resolve localhost on some setups (web search also confirms that). This change will advertise "127.0.0.1" as inspector host name. Fixes: https://github.com/nodejs/node/issues/9382 Fixes: https://github.com/nodejs/node/issues/9188 PR-URL: https://github.com/nodejs/node/pull/9451 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Michaƫl Zasso Reviewed-By: James M Snell --- src/inspector_agent.cc | 2 +- test/inspector/test-inspector.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index cb20bd702f37d1..11ee568b5e2dd2 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -40,7 +40,7 @@ static const uint8_t PROTOCOL_JSON[] = { std::string GetWsUrl(int port, const std::string& id) { char buf[1024]; - snprintf(buf, sizeof(buf), "localhost:%d/%s", port, id.c_str()); + snprintf(buf, sizeof(buf), "127.0.0.1:%d/%s", port, id.c_str()); return buf; } diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index eba4a0fc05dac2..ccc8b1a05853fa 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -11,7 +11,7 @@ function checkListResponse(err, response) { assert.ok(response[0]['devtoolsFrontendUrl']); assert.ok( response[0]['webSocketDebuggerUrl'] - .match(/ws:\/\/localhost:\d+\/[0-9A-Fa-f]{8}-/)); + .match(/ws:\/\/127.0.0.1:\d+\/[0-9A-Fa-f]{8}-/)); } function checkVersion(err, response) {