From f5d6ff56d7f63f81e650407153ffe99a72eb8379 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 16 Dec 2012 21:14:44 -0300 Subject: [PATCH] url: moar simplifications --- lib/url.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/url.js b/lib/url.js index 37fdb242..f0d96ca7 100644 --- a/lib/url.js +++ b/lib/url.js @@ -22,9 +22,7 @@ module.exports = parse; function parse(uri){ var obj = uri; - if (null == url) { - url = location.protocol + '//' + location.hostname; - } + if (null == url) url = location.protocol + '//' + location.hostname; if ('string' == typeof uri) { if ('/' == uri.charAt(0)) { @@ -48,9 +46,6 @@ function parse(uri){ obj = url.parse(uri); } - // in absence of `protocol` - if (!obj.protocol) obj.protocol = obj.secure ? 'https:' : 'http:'; - // make sure we treat `localhost:80` and `localhost` equally if ((/(http|ws):/.test(obj.protocol) && 80 == obj.port) || (/(http|ws)s:/.test(obj.protocol) && 443 == obj.port)) {