← Back to Pull requests

fix(selector): 同 host 的绝对 http 链接自动升级为 https #3633

Closed
unknown closed this pull request without merging on Oct 20, 2026 10:04 UTC
View on GitHub
unknown unknown commented on Oct 18, 2026 13:11 UTC
Author

问题

部分站点页面本身是 https,但输出的详情页/选集链接是绝对 http(模板里硬编码)。浏览器会先请求 http 再被 301 跳到 https;而 web selector 引擎会直接以 http:// 请求。明文 80 端口在部分网络下会被直接阻断,导致整个数据源失效。

实测(直连、无代理)以 agedm.io 为例(搜索页为 https,详情链接却是 http://www.agedm.io/detail/...):

  • searchEpisodes 抛 RepositoryNetworkException,3 部番全部失败;

  • 同一路径用 https 正常(1.5s / 200);

  • http 经代理访问正常(0.09s / 301)——排除站点问题,是明文 http 直连被网络阻断。
  • 修复

    web/format 层的 URL 构造统一走新的 computeSelectorUrl:

  • 当基地址是 https、链接与基地址同 host(允许 www. 前缀差异)、且是默认端口的绝对 http URL 时,把 scheme 升级为 https;

  • 其余情况(跨 host / 基地址为 http / 非默认端口 / 无法解析)保持原样,不改变跨站链接行为。
  • 覆盖 SelectorSubjectFormat(条目详情页链接)与 SelectorChannelFormat(选集链接,index-grouped 与 no-channel 两处)。

    验证

    1. 新增单测 SelectorSameHostHttpToHttpsTest(9 个用例:同 host 升级 / www 前缀等价 / 跨 host 不变 / http base 不变 / 相对链接 / 非默认端口不变 / query+fragment 保留)。
    2. 真实 E2E:用包含本补丁的 datasource-test-mcp 直连评测 agedm.io 数据源:
    - 修复前:3 部番全部 RepositoryNetworkException;
    - 修复后:13/13、10/10、8/8 条候选全部解析出视频 URL,mpv 实播正常。
    3. 回归:现有源 2k动漫 在打补丁的构建下解析正常(间谍过家家 2/2、迷宫饭 1/1;芙莉莲条目偶发播放器不出流,重试即恢复)。对比打补丁前后的 trace,其条目/选集 URL 逐字一致——本补丁对该源不产生任何 URL 变化,失败为站点侧播放器抖动。

    备注

  • 只影响 selector 的页面链接构造;matchVideoUrl 与播放期 WebView 的嵌套播放器捕获链路不经过该函数。

  • 相比"先跟随 http 再 301",直接 https 也省掉一次明文请求。
  • Diff: 157 lines (+117 / -40) across 1 files Reviewer: wdw89 Review duration: 2693m
    All Vouch review confidence checks passed
    Residual risk 0.13 = Change Risk (0.33) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.33 · 157 lines diff across 1 files
    0.33
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.303
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3633"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 33.3% (LOW) · Higher = larger blast radius
    33.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 13.2% · Safe to merge
    13.2%