File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,16 @@ WebSocket.prototype._onConnect = function(req, socket){
3030 this . draft = 76 ;
3131 }
3232
33- var origin = this . request . headers . origin ;
33+ var origin = this . request . headers . origin ,
34+ location = ( this . connection . secure ? 'wss' : 'ws' ) + '://' + this . request . headers . host + this . request . url ;
3435
3536 if ( this . draft == 76 ) {
3637 headers = [
3738 'HTTP/1.1 101 WebSocket Protocol Handshake' ,
3839 'Upgrade: WebSocket' ,
3940 'Connection: Upgrade' ,
40- 'Sec-WebSocket-Origin: ' + ( origin || 'null' ) ,
41- 'Sec-WebSocket-Location: ' + origin . replace ( / ^ h t t p / , 'ws' ) + this . request . url
41+ 'Sec-WebSocket-Origin: ' + origin ,
42+ 'Sec-WebSocket-Location: ' + location
4243 ] ;
4344
4445 if ( 'sec-websocket-protocol' in this . request . headers ) {
@@ -50,7 +51,7 @@ WebSocket.prototype._onConnect = function(req, socket){
5051 'Upgrade: WebSocket' ,
5152 'Connection: Upgrade' ,
5253 'WebSocket-Origin: ' + origin ,
53- 'WebSocket-Location: ' + origin . replace ( / ^ h t t p / , 'ws' ) + this . request . url
54+ 'WebSocket-Location: ' + location
5455 ] ;
5556
5657 try {
You can’t perform that action at this time.
0 commit comments