Strip protocol information from host field, checking for encryption
Fixes #1192
This commit is contained in:
parent
6e45939f38
commit
bc41cab976
@ -663,9 +663,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
$rootScope.hostInvalid = false;
|
$rootScope.hostInvalid = false;
|
||||||
|
|
||||||
var parts;
|
var parts;
|
||||||
|
var regexProto = /^(https?|wss?):\/\/(.+)$/;
|
||||||
var regexHost = /^([^:\/]*|\[.*\])$/;
|
var regexHost = /^([^:\/]*|\[.*\])$/;
|
||||||
var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
|
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
|
if ((parts = regexHost.exec(settings.hostField)) !== null) { //host only
|
||||||
settings.host = parts[1];
|
settings.host = parts[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user