mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
url: moar simplifications
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user