fix(qbittorrent): handle non-200 response during login to prevent long startup waits#2248
Open
airium wants to merge 1 commit intoOpenListTeam:mainfrom
Open
fix(qbittorrent): handle non-200 response during login to prevent long startup waits#2248airium wants to merge 1 commit intoOpenListTeam:mainfrom
airium wants to merge 1 commit intoOpenListTeam:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the qBittorrent WebUI login flow to fail fast on non-200 HTTP responses, preventing OpenList from blocking during startup when the target endpoint responds with unexpected protocol upgrades (e.g., HTTP 101).
Changes:
- Add an early
StatusCode == 200check in qBittorrent login to avoid reading a potentially non-terminating response body. - Improve startup behavior by returning a clear login failure error when qBittorrent API expectations are not met.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description / 描述
openlist 默认在启动时访问 8080 端口测试 qbittorrent webui 连通性.
但是如果特殊程序如 vmess websocket 占用 8080, 由于该代理协议的特点, 不会返回任何payload
openlist 尝试登录后会收到 HTTP 101 升级 ws 后会长时间阻塞等待 body, 导致 openlist 在启动半途卡住
会卡在这里完全不动, 有时数分钟无法等到:
可以使用 curl 快速复现卡住:
根据 qb 官方 api 文档 https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#login, 正常登录仅会返回 HTTP 200
因此可以将非 200 的返回值全部直接视为失败, 从而避免阻塞/卡住
Motivation and Context / 背景
No related
How Has This Been Tested? / 测试
添加该patch后, 启动时qb检测环节遇到非200返回能够正常改出, 不再卡住
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。