sogou engine: AttributeError on resp.next_request after curl_cffi migration
Description
The sogou engine intermittently returns 0 results and is reported as "unexpected crash" in unresponsive_engines.
Within the same batch of queries, some return 9-11 results normally, while others return 0 results and crash.
Cause: after the HTTP client was migrated from httpx to curl_cffi (PR #6620), searx/engines/sogou.py still uses the httpx-only attribute resp.next_request at line 56. The curl_cffi response object has no next_request attribute, so an AttributeError is raised.
It is intermittent because Python's "and" short-circuits:
- upstream returns 200 -> "resp.status_code == 302" is False -> next_request is never evaluated -> works fine
- upstream returns 302 -> evaluation continues -> AttributeError
Expected behavior: the same check should use the Location header, as searx/engines/baidu.py already does:
if "www.sogou.com/antispider" in resp.headers.get("Location", ""):
raise SearxEngineCaptchaException()This is the only place in sogou.py still using the httpx API; master still has 2 occurrences of resp.next_request.
How to reproduce
Environment: Docker Compose, image searxng/searxng:2026.9.15-ca4965040 (VERSION_STRING = "2026.9.15+ca4965040").
Query the sogou engine directly:
curl -s "http://127.0.0.1:8080/search?q=test&format=json&engines=sogou"
Repeat with several different queries. For some of them the upstream www.sogou.com answers with an anti-spider 302 redirect.
When the upstream returns 302, the engine yields 0 results and appears in unresponsive_engines as ["sogou", "unexpected crash"].
When the upstream returns 200, the very same engine returns results normally (9-11 results).
To make step 2 deterministic, request the same URL directly with the same User-Agent used by the engine, and observe the 302 to http://www.sogou.com/antispider/...
Screenshots & Logs
Log output:
WARNING:searx.engines.sogou: ErrorContext('searx/engines/sogou.py', 56, 'and resp.next_request is not None', 'AttributeError', None, ()) False
The upstream response in the failing case, obtained by requesting the same URL with the same User-Agent directly:
HTTP/1.1 302 Found Location: http://www.sogou.com/antispider/?m=1&antip=web_sh2&from=%2Fweb%3Fquery%3D...
Relevant source, searx/engines/sogou.py lines 53-58 (2026.9.15):
def response(resp): if ( resp.status_code == 302 and resp.next_request is not None # line 56 and str(resp.next_request.url).startswith("http://www.sogou.com/antispider") ): raise SearxEngineCaptchaException()
Note line 48 sets params["allow_redirects"] = False.
Version of SearXNG
2026.9.15+ca4965040
How did you install SearXNG?
Docker Compose
Code of Conduct
- I read the AI Policy and hereby confirm that this issue conforms with the policy.
Source: searxng/searxng