Skip to content
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

Crash on web socket server connect #140

Closed
ks07 opened this issue Nov 3, 2017 · 2 comments
Closed

Crash on web socket server connect #140

ks07 opened this issue Nov 3, 2017 · 2 comments

Comments

@ks07
Copy link
Contributor

ks07 commented Nov 3, 2017

Using NodeJS v8.9.0 and node-http-mitm-proxy v0.6.0 I encountered the following error whilst connecting via the mitm proxy:

Nov 03 15:23:56 /node_modules/http-mitm-proxy/lib/proxy.js:583
Nov 03 15:23:56   if (ctx.clientToProxyWebSocket.upgradeReq.url == '' || /^\//.test(ctx.clientToProxyWebSocket.upgradeReq.url)) {
Nov 03 15:23:56                                             ^
Nov 03 15:23:56
Nov 03 15:23:56 TypeError: Cannot read property 'url' of undefined
Nov 03 15:23:56     at Proxy._onWebSocketServerConnect (/node_modules/http-mitm-proxy/lib/proxy.js:583:45)
Nov 03 15:23:56     at emitTwo (events.js:126:13)
Nov 03 15:23:56     at WebSocketServer.emit (events.js:214:7)
Nov 03 15:23:56     at handleUpgrade (/node_modules/ws/lib/WebSocketServer.js:88:16)
Nov 03 15:23:56     at WebSocketServer.completeUpgrade (/node_modules/ws/lib/WebSocketServer.js:270:5)
Nov 03 15:23:56     at WebSocketServer.handleUpgrade (/node_modules/ws/lib/WebSocketServer.js:197:10)
Nov 03 15:23:56     at Server.WebSocketServer._ultron.on (/node_modules/ws/lib/WebSocketServer.js:87:14)
Nov 03 15:23:56     at emitThree (events.js:136:13)
Nov 03 15:23:56     at Server.emit (events.js:217:7)
Nov 03 15:23:56     at onParserExecuteCommon (_http_server.js:495:14)

Unfortunately I don't have details of the request that caused this crash.

@ks07
Copy link
Contributor Author

ks07 commented Nov 7, 2017

I am able to reliably reproduce this problem when using the mitm proxy in front of chromium 59.0.3071.115 on Windows 10 when browsing to the following URL:

https://travel.stackexchange.com/questions/104883/electronic-items-to-take-from-us-to-india

The network inspector gives the following request details:

Request URL: wss://qa.sockets.stackexchange.com/
Request Headers
Provisional headers are shown
Accept-Encoding:gzip, deflate, br
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Cache-Control:no-cache
Connection:Upgrade
Cookie:prov=3f255cf5-22cc-07f4-adc7-e34ff049fe9a; __qca=P0-1180722419-1509973039326; _ga=GA1.2.1466709335.1509973038; _gid=GA1.2.2016635976.1510062446; _gat=1
Host:qa.sockets.stackexchange.com
Origin:https://travel.stackexchange.com
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
Sec-WebSocket-Key:Bkwqqvt2t4DR3qB31KLZ5Q==
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
X-Extra-Headers:george_test_george_test

@ks07
Copy link
Contributor Author

ks07 commented Nov 7, 2017

This was caused by the update of the ws dependency to 3.2.0. The upgradeReq property was removed in websockets/ws#1099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant