commit: bb126da0fb49d1c9640eeb3371d0bbcf005bcd2b
parent 0616d26feb0f96b3d4fd6b2744ae0288c9fed96b
Author: Thomas Pointhuber <thomas.pointhuber@gmx.at>
Date: Wed, 15 Oct 2014 14:47:03 +0200
improve https rewrite code
Diffstat:
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/searx/https_rewrite.py b/searx/https_rewrite.py
@@ -137,3 +137,5 @@ def load_https_rules(rules_path):
# append ruleset
https_rules.append(ruleset)
+
+ print(' * {n} https-rules loaded'.format(n=len(https_rules)))
diff --git a/searx/webapp.py b/searx/webapp.py
@@ -224,10 +224,14 @@ def index():
# process rules
for rule in rules:
- # TODO, precompile rule
- p = re.compile(rule[0])
- # rewrite url if possible
- new_result_url = p.sub(rule[1], result['url'])
+ try:
+ # TODO, precompile rule
+ p = re.compile(rule[0])
+
+ # rewrite url if possible
+ new_result_url = p.sub(rule[1], result['url'])
+ except:
+ break
# parse new url
new_parsed_url = urlparse(new_result_url)