From f5c32c14909113607973e566f8205ab29b6c464f Mon Sep 17 00:00:00 2001 From: Seggy Umboh Date: Fri, 14 Sep 2012 18:43:53 -0700 Subject: [PATCH] Fixed global leak --- lib/transports/websocket/default.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/transports/websocket/default.js b/lib/transports/websocket/default.js index 091fdd44fd..4e23835def 100644 --- a/lib/transports/websocket/default.js +++ b/lib/transports/websocket/default.js @@ -74,7 +74,8 @@ WebSocket.prototype.protocolVersion = 'hixie-76'; */ WebSocket.prototype.onSocketConnect = function () { - var self = this; + var self = this + , location; this.socket.setNoDelay(true); @@ -89,11 +90,11 @@ WebSocket.prototype.onSocketConnect = function () { var origin = this.req.headers['origin'] , waitingForNonce = false; - if(this.manager.settings['match origin protocol']){ + if (this.manager.settings['match origin protocol']) { location = (origin.indexOf('https')>-1 ? 'wss' : 'ws') + '://' + this.req.headers.host + this.req.url; - }else if(this.socket.encrypted){ + } else if (this.socket.encrypted){ location = 'wss://' + this.req.headers.host + this.req.url; - }else{ + } else { location = 'ws://' + this.req.headers.host + this.req.url; }