Merge pull request #1193 from glowing-bear/strip-protocol
Strip protocol information from host field, checking for encryption
This commit is contained in:
commit
5d554152bf
@ -663,9 +663,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||
$rootScope.hostInvalid = false;
|
||||
|
||||
var parts;
|
||||
var regexProto = /^(https?|wss?):\/\/(.+)$/;
|
||||
var regexHost = /^([^:\/]*|\[.*\])$/;
|
||||
var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
|
||||
var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/;
|
||||
var regexHostPortPath = /^([^:]*|\[.*\]):(\d+)\/(.+)$/;
|
||||
|
||||
// First, remove possible protocol info - we don't want it
|
||||
if ((parts = regexProto.exec(settings.hostField)) !== null) {
|
||||
settings.hostField = parts[2];
|
||||
if (parts[1] === "http" || parts[1] === "ws") {
|
||||
settings.ssl = false;
|
||||
} else if (parts[1] === "https" || parts[1] === "wss") {
|
||||
settings.ssl = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((parts = regexHost.exec(settings.hostField)) !== null) { //host only
|
||||
settings.host = parts[1];
|
||||
|
Loading…
Reference in New Issue
Block a user