Fixed #188 and fixed a bug where secure wasn't correctly set

This commit is contained in:
Arnout Kazemier
2011-06-19 19:27:07 +02:00
parent 0b2ee0849f
commit 6363b62f43
2 changed files with 10 additions and 3 deletions

View File

@@ -161,7 +161,7 @@
if (forceNew || !io.sockets[uuri]) {
socket = new io.Socket({
host: uri.host
, secure: uri.protocol == 'https://'
, secure: uri.protocol == 'https'
, port: uri.port || 80
});
}

View File

@@ -24,6 +24,7 @@
this.options = {
port: 80
, secure: false
, host: document ? document.domain : false
, document: document
, resource: 'socket.io'
, transports: io.transports
@@ -107,7 +108,8 @@
function empty () { };
Socket.prototype.handshake = function (fn) {
var self = this;
var self = this
, options = this.options;
function complete (data) {
if (data instanceof Error) {
@@ -117,7 +119,12 @@
}
};
var url = this.options.resource + '/' + io.protocol + '/?t=' + (+ new Date);
var url = [
'http' + (options.secure ? 's' : '' ) + '://' + options.host + ':' + options.port
, this.options.resource
, io.protocol
, '?t=' + + new Date
].join('/');
if (this.isXDomain()) {
var insertAt = document.getElementsByTagName('script')[0]