fix(qbittorrent): show set-cookie presence in login diagnostic
When the login endpoint returns an unexpected response (e.g. a 204 No Content with no body), the diagnostic now reports whether a Set-Cookie header was present. That single fact tells us whether qBittorrent attempted to establish a session at all — distinguishing "qBittorrent answered weirdly" from "something in the proxy path answered before qBittorrent" (e.g. a 204 from a misrouted reverse proxy), which is the key clue when diagnosing login failures behind a proxy. 42/42 qBittorrent + credential-tester tests pass; ruff clean.
This commit is contained in:
@@ -84,11 +84,12 @@ class QbittorrentClient:
|
||||
return
|
||||
if body == "Fails.":
|
||||
raise RuntimeError(f"qBittorrent login failed (HTTP {resp.status_code}): invalid username or password")
|
||||
set_cookie = "yes" if resp.headers.get("Set-Cookie") else "no"
|
||||
raise RuntimeError(
|
||||
f"Unexpected response from qBittorrent login endpoint (HTTP {resp.status_code}, "
|
||||
f"body={body!r}). Expected the text 'Ok.' from /api/v2/auth/login — this usually "
|
||||
"means base_url does not reach the qBittorrent Web API (check the URL, path, "
|
||||
"and any reverse proxy in front of qBittorrent)."
|
||||
f"body={body!r}, set-cookie={set_cookie}). Expected the text 'Ok.' (or an SID cookie) "
|
||||
"from /api/v2/auth/login — this usually means base_url does not reach the qBittorrent "
|
||||
"Web API (check the URL, path, and any reverse proxy in front of qBittorrent)."
|
||||
)
|
||||
|
||||
def _get(self, path: str, **params: Any) -> dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user