From 5d95663f631c2ac6079c6656ba2a0524dd1d550a Mon Sep 17 00:00:00 2001 From: kane Date: Mon, 28 Nov 2022 14:15:45 +0800 Subject: [PATCH] fix proxy proto string strip --- service/settings.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/settings.py b/service/settings.py index ed1fecf74..c7fe837a1 100644 --- a/service/settings.py +++ b/service/settings.py @@ -222,9 +222,9 @@ class NetworkSettings: if prefix not in proxydict: continue proxyline = proxydict[prefix] - proto = "{0}://".format(prefix) - if proxyline[:len(proto)] == proto: - proxyline = proxyline[len(proto):] + proto_pos = proxyline.find('://') + if proto_pos != -1: + proxyline = proxyline[proto_pos+3:] # sometimes proxyline contains "user:password@" section before proxy address # remove it if present, so later split by ":" works if '@' in proxyline: