diff options
author | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-10-15 14:47:03 +0200 |
---|---|---|
committer | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-10-15 14:47:03 +0200 |
commit | bb126da0fb49d1c9640eeb3371d0bbcf005bcd2b (patch) | |
tree | eeb44287d1d67059bc296c3ff6a59ece8ce2ce01 /searx | |
parent | 0616d26feb0f96b3d4fd6b2744ae0288c9fed96b (diff) | |
download | searxng-bb126da0fb49d1c9640eeb3371d0bbcf005bcd2b.tar.gz searxng-bb126da0fb49d1c9640eeb3371d0bbcf005bcd2b.zip |
improve https rewrite code
Diffstat (limited to 'searx')
-rw-r--r-- | searx/https_rewrite.py | 2 | ||||
-rw-r--r-- | searx/webapp.py | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/searx/https_rewrite.py b/searx/https_rewrite.py index 814eda2de..18405d87a 100644 --- 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 index d9dc5f710..25c99d94c 100644 --- 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) |