From 9cf2d765aa76fded90d3cdb92802bb88e46c10a8 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Fri, 22 Oct 2021 16:12:19 +0200 Subject: [PATCH] New proxy regexp --- src/js/proxified-containers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/proxified-containers.js b/src/js/proxified-containers.js index 3fdcf30..d8c7910 100644 --- a/src/js/proxified-containers.js +++ b/src/js/proxified-containers.js @@ -93,13 +93,13 @@ proxifiedContainers = { }, - //Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional) + // 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 = /(?(https?)|(socks4?)):\/\/(\b(?\w+):(?\w+)@)?(?((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)(\.([\w.-]+))+))(:(?\d+))?/; - if (proxyRegexp.test(proxy_str) !== true) { + const proxyRegexp = /(?(https?)|(socks4?)):\/\/(\b(?\w+):(?\w+)@)?(?((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?\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";