Pārlūkot izejas kodu

improve https rewriting

Thomas Pointhuber 10 gadus atpakaļ
vecāks
revīzija
0616d26feb
2 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. 4
    2
      searx/__init__.py
  2. 3
    0
      searx/webapp.py

+ 4
- 2
searx/__init__.py Parādīt failu

@@ -24,5 +24,7 @@ else:
24 24
 with open(settings_path) as settings_yaml:
25 25
     settings = load(settings_yaml)
26 26
 
27
-# loade https rules
28
-load_https_rules(https_rewrite_path)
27
+# load https rules only if https rewrite is enabled
28
+if settings.get('server', {}).get('https_rewrite'):
29
+    # loade https rules
30
+    load_https_rules(https_rewrite_path)

+ 3
- 0
searx/webapp.py Parādīt failu

@@ -247,6 +247,9 @@ def index():
247 247
                             # set new url
248 248
                             result['url'] = new_result_url
249 249
 
250
+                    # target has matched, do not search over the other rules 
251
+                    break
252
+
250 253
         if search.request_data.get('format', 'html') == 'html':
251 254
             if 'content' in result:
252 255
                 result['content'] = highlight_content(result['content'],