From a41b41a5409e41907982504dc0d6fd0c8c7968f9 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 7f82b7b0516fa6..44c7501375e3eb 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -39,7 +39,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 d3d0bbd55923c1..75c645bb222781 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) {