lib/faye-browser.js in faye-0.8.4 vs lib/faye-browser.js in faye-0.8.5

- old
+ new

@@ -11,11 +11,11 @@ } return dest; }; Faye.extend(Faye, { - VERSION: '0.8.4', + VERSION: '0.8.5', BAYEUX_VERSION: '1.0', ID_LENGTH: 160, JSONP_CALLBACK: 'jsonpcallback', CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'], @@ -1271,19 +1271,20 @@ }), { parse: function(url, params) { if (typeof url !== 'string') return url; var uri = new this(), parts; - var consume = function(name, pattern) { + var consume = function(name, pattern, infer) { url = url.replace(pattern, function(match) { uri[name] = match; return ''; }); - if (uri[name] === undefined) uri[name] = Faye.ENV.location[name]; + if (uri[name] === undefined) + uri[name] = infer ? Faye.ENV.location[name] : ''; }; - consume('protocol', /^https?\:/); - consume('host', /^\/\/[^\/]+/); + consume('protocol', /^https?\:/, true); + consume('host', /^\/\/[^\/]+/, true); if (!/^\//.test(url)) url = Faye.ENV.location.pathname.replace(/[^\/]*$/, '') + url; consume('pathname', /^\/[^\?#]*/); consume('search', /^\?[^#]*/); consume('hash', /^#.*/);