magpie icon indicating copy to clipboard operation
magpie copied to clipboard

TestBunProxyLoginWithReservedCharacters is red with Bun 1.3: the request line names port 80

Open yinwu01 opened this issue 1 month ago • 1 comments

b437e4ad 新加的 TestBunProxyLoginWithReservedCharacters 在我这里是红的:

login_test.go:199: bun through the HTTP proxy: <nil> carried http://vendor.example:80/x

我 PATH 上的 bun 是 1.3.11,它走 HTTP 代理时 request line 里带了默认端口 :80。登录其实是通的,fake 代理只有 Proxy-Authorization 对上才会回 carried,只是最后的字符串比较太严。CI 装的是 1.4.2,b437e4ad 的 CI 是绿的。magpie 跑插件用的是自己下的 Bun(BunVersion 1.4.2),用户那边没影响,只是本地 bun 旧一点的人跑全量会多一个红。

比较前把默认端口去掉就行。我在 1.3.11 上试过是绿的,故意把密码改错一个字符还是会红(proxy login refused):

	// Bun 1.3 names the default port in the request line, 1.4 doesn't
	got := strings.Replace(strings.TrimSpace(string(out)), "http://vendor.example:80/", "http://vendor.example/", 1)
	if err != nil || got != "carried http://vendor.example/x" {

yinwu01 avatar Oct 23 '26 17:10 yinwu01

已修复,分支 fix/3397-bun-proxy-default-port,提交 eaae69f2,基于上游 ed0ab567。

测试现在只接受相同目标的两种完整结果:http://vendor.example/x 和显式默认端口 http://vendor.example:80/x;代理认证检查不变,其他主机、路径和端口仍不通过。

用本地代理重放 Bun 1.3 的请求行:原测试失败、修改后通过;实际 Bun 1.4.4 测试通过。临时改错代理密码时仍返回 proxy login refused,还原后通过。相关 netproxy race、vet、build 和格式检查通过,我另独立重跑了真实 Bun 测试。

本机没有 Bun 1.3,旧版本结果来自请求行重放,未实际运行旧版;未运行全仓库和跨平台测试。实现和审查使用了 AI 辅助。

skygunner avatar Nov 08 '26 20:11 skygunner