New proxy regexp

This commit is contained in:
Andrea Marchesini 2021-10-22 16:12:19 +02:00
parent 2f6e49bec0
commit 9cf2d765aa

View file

@ -95,11 +95,11 @@ proxifiedContainers = {
// Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional)
parseProxy(proxy_str, mozillaVpnData = null) {
const proxyRegexp = /(?<type>(https?)|(socks4?)):\/\/(\b(?<username>\w+):(?<password>\w+)@)?(?<host>((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)(\.([\w.-]+))+))(:(?<port>\d+))?/;
if (proxyRegexp.test(proxy_str) !== true) {
const proxyRegexp = /(?<type>(https?)|(socks4?)):\/\/(\b(?<username>\w+):(?<password>\w+)@)?(?<host>((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?<port>\d+))?/;
const matches = proxyRegexp.exec(proxy_str);
if (!matches) {
return false;
}
const matches = proxyRegexp.exec(proxy_str);
if (mozillaVpnData && mozillaVpnData.mozProxyEnabled === undefined) {
matches.groups.type = "direct";