diff options
author | Alexandre Flament <alex@al-f.net> | 2021-03-12 19:21:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 19:21:46 +0100 |
commit | a1a492baed8f6d531ea95cf4fde539e48328f3cb (patch) | |
tree | cfb20a8974598c0fd90d2426220e95366cef480c /searx/engines | |
parent | af3e969c5a4d7b9170076ffc74ec52b24f00915c (diff) | |
parent | 99e0651ceaffdc9f57ca4fc1be50fdec8864f4cb (diff) | |
download | searxng-a1a492baed8f6d531ea95cf4fde539e48328f3cb.tar.gz searxng-a1a492baed8f6d531ea95cf4fde539e48328f3cb.zip |
Merge pull request #2641 from dalf/disable_http_by_default
[mod] by default allow only HTTPS, not HTTP
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/__init__.py | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 7270724b6..2238ea1b9 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -50,6 +50,7 @@ engine_default_args = {'paging': False, 'timeout': settings['outgoing']['request_timeout'], 'shortcut': '-', 'disabled': False, + 'enable_http': False, 'suspend_end_time': 0, 'continuous_errors': 0, 'time_range_support': False, @@ -305,35 +306,3 @@ def initialize_engines(engine_list): if init_fn: logger.debug('%s engine: Starting background initialization', engine_name) threading.Thread(target=engine_init, args=(engine_name, init_fn)).start() - - _set_https_support_for_engine(engine) - - -def _set_https_support_for_engine(engine): - # check HTTPS support if it is not disabled - if engine.engine_type != 'offline' and not hasattr(engine, 'https_support'): - params = engine.request('http_test', { - 'method': 'GET', - 'headers': {}, - 'data': {}, - 'url': '', - 'cookies': {}, - 'verify': True, - 'auth': None, - 'pageno': 1, - 'time_range': None, - 'language': '', - 'safesearch': False, - 'is_test': True, - 'category': 'files', - 'raise_for_status': True, - 'engine_data': {}, - }) - - if 'url' not in params: - return - - parsed_url = urlparse(params['url']) - https_support = parsed_url.scheme == 'https' - - setattr(engine, 'https_support', https_support) |