diff --git a/lib/socket.js b/lib/socket.js index 8491c678a..d1e2e4be6 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -179,7 +179,7 @@ for (var i = 0, transport; transport = transports[i]; i++) { if (io.Transport[transport] && io.Transport[transport].check(this) - && (!this.isXDomain() || io.Transport[transport].xdomainCheck())) { + && (!this.isXDomain() || io.Transport[transport].xdomainCheck(this))) { return new io.Transport[transport](this, this.sessionid); } } @@ -359,10 +359,17 @@ Socket.prototype.disconnectSync = function () { // ensure disconnection - var xhr = io.util.request() - , uri = this.resource + '/' + io.protocol + '/' + this.sessionid; - + var xhr = io.util.request(); + var uri = [ + 'http' + (this.options.secure ? 's' : '') + ':/' + , this.options.host + ':' + this.options.port + , this.options.resource + , io.protocol + , this.sessionid + ].join('/'); + xhr.open('GET', uri, true); + xhr.send(null); // handle disconnection immediately this.onDisconnect('booted'); diff --git a/lib/transports/htmlfile.js b/lib/transports/htmlfile.js index b3b5666b7..69684a2d4 100644 --- a/lib/transports/htmlfile.js +++ b/lib/transports/htmlfile.js @@ -134,11 +134,11 @@ * @api public */ - HTMLFile.check = function () { + HTMLFile.check = function (socket) { if (typeof window != "undefined" && 'ActiveXObject' in window){ try { var a = new ActiveXObject('htmlfile'); - return a && io.Transport.XHR.check(); + return a && io.Transport.XHR.check(socket); } catch(e){} } return false; diff --git a/lib/transports/xhr.js b/lib/transports/xhr.js index 9a6eb3c19..dab91f55d 100644 --- a/lib/transports/xhr.js +++ b/lib/transports/xhr.js @@ -206,8 +206,8 @@ * @api public */ - XHR.xdomainCheck = function () { - return XHR.check(null, true); + XHR.xdomainCheck = function (socket) { + return XHR.check(socket, true); }; })(