New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"HTTP 403" using node-inspector on windows (node.exe) #62

Closed
SongPing opened this Issue Aug 24, 2011 · 11 comments

Comments

Projects
None yet
4 participants
@SongPing

SongPing commented Aug 24, 2011

Node-inspector was started by: node ./bin/inspector
returning: visit http://0.0.0.0:8080/debug?port=5858 to start debugging

Server to debug was started by: node --debug server
returning: debugger listening on port 5858

Chrome: http://127.0.0.1:8080/debug?port=5858
returning: html page with content "HTTP 403" == forbidden

Versions:
node.exe Version 0.5.4
Google Chrome 13.0.782.215.
node-inspector: actual

On Linux it's working fine (but I need it on Windows)

@dannycoates

This comment has been minimized.

Show comment
Hide comment
@dannycoates

dannycoates Aug 26, 2011

Member

I don't have a Windows machine to test this on. The only thing I can think to try is using a different port?

node ./bin/inspector --web-port=9999

Or maybe try using localhost instead of 127.0.0.1?

It feels like a networking issue, but it could be something different about how the node on Windows handles http.

If that doesn't work, maybe you could find out more by using the Developer Tools, Network tab on the inspector page to see the request/response headers.

Member

dannycoates commented Aug 26, 2011

I don't have a Windows machine to test this on. The only thing I can think to try is using a different port?

node ./bin/inspector --web-port=9999

Or maybe try using localhost instead of 127.0.0.1?

It feels like a networking issue, but it could be something different about how the node on Windows handles http.

If that doesn't work, maybe you could find out more by using the Developer Tools, Network tab on the inspector page to see the request/response headers.

@bubersson

This comment has been minimized.

Show comment
Hide comment
@bubersson

bubersson Sep 2, 2011

I have exactly same problem with node-inspector on node.exe. Changing ports doesn't help. It may be related to use of compiled node.exe, not the one under cygwin.

GET /debug?port=5858 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: cs-CZ,cs;q=0.8
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.3

HTTP/1.1 403 Forbidden
Content-Type: text/html
Connection: keep-alive
Transfer-Encoding: chunked

bubersson commented Sep 2, 2011

I have exactly same problem with node-inspector on node.exe. Changing ports doesn't help. It may be related to use of compiled node.exe, not the one under cygwin.

GET /debug?port=5858 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: cs-CZ,cs;q=0.8
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.3

HTTP/1.1 403 Forbidden
Content-Type: text/html
Connection: keep-alive
Transfer-Encoding: chunked
@dannycoates

This comment has been minimized.

Show comment
Hide comment
@dannycoates

dannycoates Sep 2, 2011

Member

I'll fire up a Windows VM this weekend and have a look

Member

dannycoates commented Sep 2, 2011

I'll fire up a Windows VM this weekend and have a look

@dannycoates

This comment has been minimized.

Show comment
Hide comment
@dannycoates

dannycoates Sep 3, 2011

Member

Ok, I was able to get inspector "working" on windows 7 with node.exe 0.5.5 and Chrome 13, but it did take some screwing around and is very unstable. I used the test\hello.js and this is what I found:

  1. The firewall was initially blocking ports 5858 and 8080

  2. Using --debug caused an Error 10054 on hello.js and

    assert.js:104
    throw new assert.AssertionError({
             ^
    AssertionError: {"oncomplete":"function afterWrite(status, handle, req, buffer)
    {\n  var self = handle.socket;\n\n  // callback may come after c == {"oncomplete
    ":"function afterWrite(status, handle, req, buffer) {\n  var self = handle.socke
    t;\n\n  // callback may come after c
    at Object.afterWrite [as oncomplete] (net_uv.js:414:10)
    

    on the inspector.js (I don't know what is causing these. Something internal to node or v8)


So this is how I got it "working".

  1. Turned off the firewall
  2. Started the process with --debug-brk i.e. node --debug-brk test\hello.js
    This will cause hello.js to pause on the first line.
  3. Started node bin\inspector.js
  4. When I pulled up http://localhost:8080 the UI was kinda screwy. I had to click between 'Scripts' and 'Console' tabs a few times, and then the 'hide console' button in the lower right corner.
  5. I can set breakpoints, hit them and examine variables for a minute or so, then everything either crashes or freezes

I think node on windows isn't stable enough for debugging yet. I'll keep this open until the official release of node on windows and try again.

Member

dannycoates commented Sep 3, 2011

Ok, I was able to get inspector "working" on windows 7 with node.exe 0.5.5 and Chrome 13, but it did take some screwing around and is very unstable. I used the test\hello.js and this is what I found:

  1. The firewall was initially blocking ports 5858 and 8080

  2. Using --debug caused an Error 10054 on hello.js and

    assert.js:104
    throw new assert.AssertionError({
             ^
    AssertionError: {"oncomplete":"function afterWrite(status, handle, req, buffer)
    {\n  var self = handle.socket;\n\n  // callback may come after c == {"oncomplete
    ":"function afterWrite(status, handle, req, buffer) {\n  var self = handle.socke
    t;\n\n  // callback may come after c
    at Object.afterWrite [as oncomplete] (net_uv.js:414:10)
    

    on the inspector.js (I don't know what is causing these. Something internal to node or v8)


So this is how I got it "working".

  1. Turned off the firewall
  2. Started the process with --debug-brk i.e. node --debug-brk test\hello.js
    This will cause hello.js to pause on the first line.
  3. Started node bin\inspector.js
  4. When I pulled up http://localhost:8080 the UI was kinda screwy. I had to click between 'Scripts' and 'Console' tabs a few times, and then the 'hide console' button in the lower right corner.
  5. I can set breakpoints, hit them and examine variables for a minute or so, then everything either crashes or freezes

I think node on windows isn't stable enough for debugging yet. I'll keep this open until the official release of node on windows and try again.

@bubersson

This comment has been minimized.

Show comment
Hide comment
@bubersson

bubersson Sep 3, 2011

Ok, thanks for your help. It seems there's still a lot of problems with node.exe on windows.
I've tried your steps, but I still got 403 (with firewall turned off - I will fiddle around that a little bit more). I guess I will have to wait few more months to expect node.exe to work fully on windows...

bubersson commented Sep 3, 2011

Ok, thanks for your help. It seems there's still a lot of problems with node.exe on windows.
I've tried your steps, but I still got 403 (with firewall turned off - I will fiddle around that a little bit more). I guess I will have to wait few more months to expect node.exe to work fully on windows...

@SongPing

This comment has been minimized.

Show comment
Hide comment
@SongPing

SongPing Sep 5, 2011

Thanks for the suggestions.
But neither changing the port, changing 127.0.0.1 -> localhost or disabling the windows firewall make any difference.
Also an update from node.js 0.5.4 to 0.5.5 (http://nodejs.org/dist/v0.5.5/node.exe) does not help.

In my experience node on windows is pretty stable !
Unfortunately I can't debug at all ;-)

SongPing commented Sep 5, 2011

Thanks for the suggestions.
But neither changing the port, changing 127.0.0.1 -> localhost or disabling the windows firewall make any difference.
Also an update from node.js 0.5.4 to 0.5.5 (http://nodejs.org/dist/v0.5.5/node.exe) does not help.

In my experience node on windows is pretty stable !
Unfortunately I can't debug at all ;-)

@SongPing SongPing closed this Sep 5, 2011

@SongPing SongPing reopened this Sep 5, 2011

@SongPing

This comment has been minimized.

Show comment
Hide comment
@SongPing

SongPing Sep 5, 2011

I closed the issue by mistake.

SongPing commented Sep 5, 2011

I closed the issue by mistake.

@fprijate

This comment has been minimized.

Show comment
Hide comment
@fprijate

fprijate Sep 5, 2011

Hi

Today (5.9.2011 ) node-inspector works also on Windows XP (node v0.5.6-pre MSVC build).
It works only with change to filepath function in paperboy.

exports.filepath = function (webroot, url) {
  var pathSep=process.platform ==='win32' ? '\\' : '/';
  // Unescape URL to prevent security holes
  url = decodeURIComponent(url);
  // Append index.html if path ends with '/'
  fp = path.normalize(path.join(webroot, (url.match(/\/$/)=='/')  ? url+'index.html' : url));
  // Sanitize input, make sure people can't use .. to get above webroot
  if (webroot[webroot.length - 1] !== pathSep) webroot += pathSep;
  if (fp.substr(0, webroot.length) != webroot)
     return(['Permission Denied', null]);
  else
     return([null, fp.replace('/',pathSep)]);
};

fprijate commented Sep 5, 2011

Hi

Today (5.9.2011 ) node-inspector works also on Windows XP (node v0.5.6-pre MSVC build).
It works only with change to filepath function in paperboy.

exports.filepath = function (webroot, url) {
  var pathSep=process.platform ==='win32' ? '\\' : '/';
  // Unescape URL to prevent security holes
  url = decodeURIComponent(url);
  // Append index.html if path ends with '/'
  fp = path.normalize(path.join(webroot, (url.match(/\/$/)=='/')  ? url+'index.html' : url));
  // Sanitize input, make sure people can't use .. to get above webroot
  if (webroot[webroot.length - 1] !== pathSep) webroot += pathSep;
  if (fp.substr(0, webroot.length) != webroot)
     return(['Permission Denied', null]);
  else
     return([null, fp.replace('/',pathSep)]);
};
@SongPing

This comment has been minimized.

Show comment
Hide comment
@SongPing

SongPing Sep 7, 2011

With the change in paperboy the debugging is working now on Windows (also with node 0.5.5).
Thank you for the help!

By the way how to get (node v0.5.6-pre MSVC build).

SongPing commented Sep 7, 2011

With the change in paperboy the debugging is working now on Windows (also with node 0.5.5).
Thank you for the help!

By the way how to get (node v0.5.6-pre MSVC build).

@fprijate

This comment has been minimized.

Show comment
Hide comment
@fprijate

fprijate Sep 7, 2011

I am building it myself from Git.

fprijate commented Sep 7, 2011

I am building it myself from Git.

@dannycoates

This comment has been minimized.

Show comment
Hide comment
@dannycoates

dannycoates Sep 7, 2011

Member

@fprijate awesome thanks! Hopefully @felixge will land your patch from felixge/node-paperboy#13 (comment)

Member

dannycoates commented Sep 7, 2011

@fprijate awesome thanks! Hopefully @felixge will land your patch from felixge/node-paperboy#13 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment