Fixed websocket uri

This commit is contained in:
Guillermo Rauch
2012-01-03 13:25:42 -08:00
parent 32fdf49498
commit 7641beecb5

View File

@@ -110,15 +110,14 @@ WS.prototype.doClose = function () {
*/
WS.prototype.uri = function () {
var opts = this.options
, query = util.qs(opts.query)
, schema = opts.secure ? 'wss' : 'ws'
var query = util.qs(this.query)
, schema = this.secure ? 'wss' : 'ws'
, port = ''
// avoid port if default for schema
if (('wss' == schema && opts.port != 443)
|| ('ws' == schema && opts.port != 80)) {
port = ':' + opts.port;
if (this.port && (('wss' == schema && this.port != 443)
|| ('ws' == schema && this.port != 80))) {
port = ':' + this.port;
}
// prepend ? to query
@@ -126,7 +125,7 @@ WS.prototype.uri = function () {
query = '?' + query;
}
return schema + opts.host + port + opts.path + query;
return schema + '://' + this.host + port + this.path + query;
};
/**