mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 02:40:11 +01:00
improve https rewrite code
This commit is contained in:
parent
0616d26feb
commit
bb126da0fb
@ -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)))
|
||||
|
@ -224,10 +224,14 @@ def index():
|
||||
|
||||
# process rules
|
||||
for rule in rules:
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user