Skip to content

fix(cli): 修复配置诊断对 HTTP(S) 协议大小写的误判 - #6819

Merged
Hmbown merged 4 commits into
codewhale-hq:mainfrom
Guan0923:codex/fix-url-scheme-case
Oct 3, 2026
Merged

Hmbown merged 4 commits into
codewhale-hq:mainfrom
Guan0923:codex/fix-url-scheme-case

Conversation

@Guan0923

@Guan0923 Guan0923 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

问题

config doctor 使用区分大小写的字符串前缀判断服务地址是否采用 HTTP 或 HTTPS 协议。

因此,使用大写或混合大小写协议的地址,例如:

[providers.deepseek]
base_url = "HTTPS://Example.invalid/API?Token=AbC"

会被错误地报告为非 HTTP(S) 地址,命令退出码为 1。

HTTP(S) 协议名称不区分大小写,不应仅因为协议使用大写而拒绝该配置。

修改

在原有检查中,对用于判断的临时字符串执行 to_ascii_lowercase(),再检查 http:// 和 https:// 前缀。

  • 原始 URL 保持不变,不改写保存的配置。
  • 路径、查询参数及其值的大小写保持不变。
  • 非 HTTP(S) 协议仍然被拒绝。
  • 不新增模块或依赖。

验证

已完成本地离线编译,并通过实际 CLI 调用验证。

修复前,同一条 HTTPS://… 配置被拒绝,退出码为 1;修复后通过,退出码为 0。

输入协议 修复后结果 退出码
http:// 通过 0
HTTP:// 通过 0
HTTPS:// 通过 0
hTtPs:// 通过 0
GOPHER:// 拒绝 1

另外,通过 config get providers.deepseek.base_url 确认原始地址保持不变,包括 /API?Token=AbC 的大小写。上述五个案例的配置文件均未被改写。

No-Issue: standalone config-doctor HTTP(S) scheme-case bug fix with a reproduction in this PR.

Use an ASCII-lowercase copy only for scheme validation; preserve the original endpoint, including case-sensitive path and query values. Verified with an offline CLI build and five direct CLI cases: four HTTP(S) spellings accepted, GOPHER rejected, and every config file unchanged. The unmodified binary rejected the same uppercase HTTPS fixture.
@Guan0923
Guan0923 requested a review from Hmbown as a code owner October 2, 2026 11:00
Copilot AI balanced review requested due to automatic review settings October 2, 2026 11:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm label Oct 2, 2026
Hmbown added 3 commits October 2, 2026 23:34
…#6819

Preserve the original contributor commits; incoming source change is only
the reviewed child_env.rs formatting repair from ad43250.

Focused rustfmt check passed in the sealed source proposal.
Hosted test matrix remains separate and pending.

Signed-off-by: Hunter B <hmbown@gmail.com>
Keep the contributor CLI source and history unchanged.
The unchanged credit validator passed over the original contributor history
plus exact upstream format merge; scoped child_env rustfmt passed.
Hosted CI remains separate and pending.

Signed-off-by: Hunter B <hmbown@gmail.com>
Regenerate the existing root-to-crate slice; only the reviewed contributor
credit line is added. The previous focused credit/format checks missed this
derived-file contract; new-head CI Version drift exposed it before credit.

Canonical generator check and unchanged contributor-credit checker
(v0.10.0) are validated on this exact proposed commit. Hosted CI remains
separate; no test-matrix pass is claimed.

Signed-off-by: Hunter B <hmbown@gmail.com>
@Hmbown
Hmbown merged commit 308c2d4 into codewhale-hq:main Oct 3, 2026
26 checks passed
Hmbown pushed a commit that referenced this pull request Oct 3, 2026
Retain the real main parent 296c05d
and the original PR merge/commit ancestry for #6819 (@Guan0923), #6829 and
#6831 (@Lstarsky0), and #6830 (@SparkofSpike). Resolve the 19 reviewed
counterparts to the exact V22 product tree, including all 156 original
translated values and the original localization regression test.

Exact V22 local checks: Rust 1351/0/0; localization 54/0/0; CI-policy Clippy PASS.
CLI: 3 actual processes / 6 checks / 6 local fixture requests / 0 paid calls; approval, resume, cancellation and EOF effects passed.
npm test + check:web: 1180 passed / 0 failed / 7 explicit skips (wrapper101, SDK19, host378, website682); strict TypeScript and production web passed.
No contributor harvesting, runtime default flip, install or release claim.

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants