diff options
author | Léon Tiekötter <leon@tiekoetter.com> | 2022-01-22 19:51:40 +0100 |
---|---|---|
committer | Léon Tiekötter <leon@tiekoetter.com> | 2022-01-27 22:37:02 +0100 |
commit | 0cbf73a1f4d8ae894f56d89a20646f5244264a44 (patch) | |
tree | 882e19b6ea0b519f0a2a4ea2b48d97701a66c195 /searx/network/network.py | |
parent | 1b03db4c737dbf0d6cf1ba4c5008c9a448f7a707 (diff) | |
download | searxng-0cbf73a1f4d8ae894f56d89a20646f5244264a44.tar.gz searxng-0cbf73a1f4d8ae894f56d89a20646f5244264a44.zip |
Allow 'using_tor_proxy' to be set for each engine individually
Check 'using_tor_proxy' for each engine individually instead of checking globally
[fix] searx.network: update _rdns test to the last httpx version
Co-authored-by: Alexandre Flament <alex@al-f.net>
Diffstat (limited to 'searx/network/network.py')
-rw-r--r-- | searx/network/network.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/searx/network/network.py b/searx/network/network.py index c9af97649..69af3b7c4 100644 --- a/searx/network/network.py +++ b/searx/network/network.py @@ -167,13 +167,14 @@ class Network: for transport in client._mounts.values(): # pylint: disable=protected-access if isinstance(transport, AsyncHTTPTransportNoHttp): continue - if not getattr(transport, '_rdns', False): - result = False - break - else: - response = await client.get('https://check.torproject.org/api/ip') - if not response.json()['IsTor']: - result = False + if getattr(transport, "_pool") and getattr( + transport._pool, "_rdns", False # pylint: disable=protected-access + ): + continue + return False + response = await client.get("https://check.torproject.org/api/ip", timeout=10) + if not response.json()["IsTor"]: + result = False Network._TOR_CHECK_RESULT[proxies] = result return result |