Skip to content

fix: xray redirect 默认跟随 / matcher DSL 快路径 / favicon 探测修复 / tinygo 兼容#33

Open
wuchulonly wants to merge 4 commits into
chainreactors:masterfrom
wuchulonly:cyberhub/upstream-fixes
Open

fix: xray redirect 默认跟随 / matcher DSL 快路径 / favicon 探测修复 / tinygo 兼容#33
wuchulonly wants to merge 4 commits into
chainreactors:masterfrom
wuchulonly:cyberhub/upstream-fixes

Conversation

@wuchulonly

Copy link
Copy Markdown
Contributor

基于当前 master(1a0a5a8)干净 cherry-pick 的 4 个修复,go build ./convert/ ./operators/ ./protocols/http/ 通过。

convert: xray follow_redirects 省略时默认跟随

xray 省略 follow_redirects 时默认跟随(== true),仅显式 false 才关闭。FollowRedirects*bool 区分"省略"与"false",省略映射为 true,避免 30x 后的产品签名(GeoServer Wicket /web/?0、Druid console、Spring Boot whitelabel)被静默丢失。

operators/matcher: 无模板标记表达式跳过重复 resolve+recompile

仅含 {{...}}/§...§ 运行时标记的表达式才走 resolve+recompile,其余复用已编译对象。避免每条响应对上万模板重复解析+编译,缓解组内串行求值的 CPU 瓶颈。

http: favicon 探测修复

  • fetchFaviconr.Context() 而非页面请求 context,避免继承页面请求已耗尽的时间预算,导致慢站点 favicon 规则假阴性
  • discoverIconURLs 用相对 favicon.ico 基于 base 解析
  • attrRE/attrValue 支持未加引号的 link 属性(如 rel=icon href=/path)

http(client): 抽出 newCookieJar 适配 tinygo 构建

标准构建走 cookiejar.New;tinygo 下 cookiejar 不可用,newCookieJar 返回 nil,使 tinygo 构建目标可编译。

🤖 Generated with Claude Code

root and others added 4 commits June 13, 2026 16:37
对齐 xray 默认行为(省略 == true),避免 30x 后的产品签名
(GeoServer Wicket /web/?0、Druid console、Spring Boot whitelabel)被静默丢失。
FollowRedirects 改 *bool 以区分"省略"与"false",显式 false 仍保持不跟随。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
仅含 {{...}}/§...§ 运行时标记的表达式才走 resolve+recompile,其余直接复用
已编译结果(common.Evaluate 对无标记表达式原样返回)。避免每条响应对上万
指纹模板重复解析+编译,缓解组内串行求值的 CPU 瓶颈。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- fetchFavicon 改用 r.Context() 而非页面请求 context,避免继承页面请求已耗尽的
  时间预算,导致慢站点的 xray 风格 favicon 规则误判为不命中
- discoverIconURLs 用相对 "favicon.ico" 基于 base 解析
- attrRE / attrValue 支持未加引号的 link 属性(如 rel=icon href=/path)

补充 fetchFavicon 独立 context 与未加引号属性解析的单元测试。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
标准构建走 cookiejar.New;tinygo 下 cookiejar 不可用,newCookieJar 返回 nil,
使 xrayconv 等 tinygo 构建目标可编译通过。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant