From 1c92d8d51f9e3583a6e60ddd93c248a87af662d9 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 6 Apr 2014 17:23:13 +0200 Subject: [PATCH] More generic implementation for --proxy-file (accepting public lists format) --- lib/core/option.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core/option.py b/lib/core/option.py index cc5412be2..ef13c86b9 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -47,6 +47,7 @@ from lib.core.common import parseTargetUrl from lib.core.common import paths from lib.core.common import randomRange from lib.core.common import randomStr +from lib.core.common import readCachedFileContent from lib.core.common import readInput from lib.core.common import resetCookieJar from lib.core.common import runningAsAdmin @@ -1947,7 +1948,10 @@ def _setProxyList(): if not conf.proxyFile: return - conf.proxyList = getFileItems(conf.proxyFile) + conf.proxyList = [] + for match in re.finditer(r"(?i)((http[^:]*|socks[^:]*)://)?([\w.]+):(\d+)", readCachedFileContent(conf.proxyFile)): + _, type_, address, port = match.groups() + conf.proxyList.append("%s://%s:%s" % (type_ or "http", address, port)) def _setTorProxySettings(): if not conf.tor: