incident:
flask_babel.gettext() does not work in the engine modules.
cause:
the request() and response() functions of the engine modules run in the
processor, whose search() method runs in a thread and in the threads the
context of the Flask app does not exist. The context of the Flask app is
needed by the gettext() function for the L10n.
Solution:
copy context of the Flask app into the threads. [1]
special case:
We cannot equip the search() method of the processors with the decorator [1],
because the decorator requires a context (Flask app) that does not yet exist
at the time of the initialization of the processors (the initialization of the
processors is part of the initialization of the Flask app).
[1] https://flask.palletsprojects.com/en/2.3.x/api/#flask.copy_current_request_context
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Over the years the webapp module became more and more a mess. To improve the
modulaization a little this patch moves some implementations from the webapp
module to webutils module.
HINT: this patch brings non functional change
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Stuff in folder searxng_extra/ is not suitable for normal users and should only
be used by developers.
The script searxng_extra/standalone_searx.py must not give the impression that
it improves privacy. [1]
[1] https://github.com/searxng/searxng/pull/651#issuecomment-1001389726
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The scripts loads the engine and then parse the arguments.
After that the engines are initialized.
Before this commit, with "--help", the HTTP clients are closed before
the engine initialization threads. When these init threads try to send
an HTTP request, an exception is raised.