summaryrefslogtreecommitdiff
path: root/searx/__init__.py
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2014-09-14 11:09:44 +0200
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2014-10-15 14:05:41 +0200
commit9b9f097adbf39d7908931203e9d8966748900bde (patch)
tree2b938c027fc9b486f3de551c8e0e4245749d379d /searx/__init__.py
parentd1d55f2ca41fbaf10a66bfc66d69e0fccf673413 (diff)
downloadsearxng-9b9f097adbf39d7908931203e9d8966748900bde.tar.gz
searxng-9b9f097adbf39d7908931203e9d8966748900bde.zip
Implementing https rewrite support #71
* parsing XML-Files which contain target, exclusions and rules * convert regex if required (is a little hack, probably does not work for all rules) * check if target rule apply for http url, and use the rules to rewrite it * add pice of code, to check if domain name has not changed during rewrite (should be rewritten, using publicsuffix instead of little hack)
Diffstat (limited to 'searx/__init__.py')
-rw-r--r--searx/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/__init__.py b/searx/__init__.py
index 375a5414a..0acc61447 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -1,5 +1,6 @@
from os import environ
from os.path import realpath, dirname, join, abspath
+from searx.https_rewrite import load_https_rules
try:
from yaml import load
except:
@@ -15,6 +16,13 @@ if 'SEARX_SETTINGS_PATH' in environ:
else:
settings_path = join(searx_dir, 'settings.yml')
+if 'SEARX_HTTPS_REWRITE_PATH' in environ:
+ https_rewrite_path = environ['SEARX_HTTPS_REWRITE_PATH']
+else:
+ https_rewrite_path = join(searx_dir, 'https_rules')
with open(settings_path) as settings_yaml:
settings = load(settings_yaml)
+
+# loade https rules
+load_https_rules(https_rewrite_path)