Skip to content

XHTTP + Reality 在 mode=auto 时失败(unexpected response version 88),mode=stream-one 正常 #5635

@lyd123qw2008

Description

@lyd123qw2008

完整性要求

  • 我读完了 issue 模板中的所有注释,确保填写符合要求。
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现

描述

Xray-core 26.1.31(Windows 客户端)在 VLESS + Reality + XHTTP 的场景下,xhttpSettings.mode=auto 无法连接,报错 proxy/vless/encoding: unexpected response version. Expecting 0 but actually 88。
将 xhttpSettings.mode 显式改为 stream-one 后即恢复正常。
这是从旧版本升级到 26.1.31 后出现的问题(之前 auto 可用)。
排查到 Xray 在 XHTTP dial 时对 auto 的处理可能与 sessionId 生成逻辑不一致:auto 在 Reality 下应等价 stream-one,但仍生成 sessionId,导致 server 侧走了非 stream-one 的处理路径。

相关源码(供参考):

  • transport/internet/splithttp/dialer.go:sessionId 生成发生在 auto -> stream-one 的解析之前
  • transport/internet/splithttp/hub.go:带 sessionId 的请求会走 stream-up / packet-up 分支

重现方式

  1. 服务端使用下方服务端配置启动 Xray-core(Linux)。
  2. 客户端使用下方客户端配置启动 Xray-core(Windows)。
  3. 访问任意 https 网站(例如 https://www.google.com)。
  4. 观察客户端日志,出现 unexpected response version. Expecting 0 but actually 88。
  5. 将客户端 xhttpSettings.mode 改为 stream-one,重启后连接恢复正常。

客户端配置

Details

  {
    "log": { "loglevel": "debug", "dnsLog": true },
    "inbounds": [
      {
        "tag": "socks",
        "port": 10808,
        "listen": "127.0.0.1",
        "protocol": "mixed",
        "settings": { "auth": "noauth", "udp": true }
      }
    ],
    "outbounds": [
      {
        "tag": "proxy",
        "protocol": "vless",
        "settings": {
          "vnext": [
            {
              "address": "SERVER_IP",
              "port": 14183,
              "users": [
                {
                  "id": "UUID",
                  "encryption": "none"
                }
              ]
            }
          ]
        },
        "streamSettings": {
          "network": "xhttp",
          "security": "reality",
          "xhttpSettings": {
            "path": "/tcobxHTTP",
            "host": "www.suny.edu",
            "mode": "auto"
          },
          "realitySettings": {
            "serverName": "www.suny.edu",
            "fingerprint": "chrome",
            "publicKey": "PUBLIC_KEY",
            "shortId": "SHORT_ID",
            "spiderX": ""
          }
        }
      },
      { "tag": "direct", "protocol": "freedom" }
    ]
  }
  

服务端配置

Details

  {
    "log": { "loglevel": "debug", "dnsLog": true },
    "inbounds": [
      {
        "listen": "0.0.0.0",
        "port": 14183,
        "protocol": "vless",
        "settings": {
          "clients": [
            {
              "id": "UUID",
              "email": "test@test",
              "encryption": "none"
            }
          ],
          "decryption": "none"
        },
        "streamSettings": {
          "network": "xhttp",
          "security": "reality",
          "xhttpSettings": {
            "path": "/tcobxHTTP"
          },
          "realitySettings": {
            "show": false,
            "dest": "www.suny.edu:443",
            "serverNames": ["www.suny.edu"],
            "privateKey": "PRIVATE_KEY",
            "shortIds": ["SHORT_ID"]
          }
        }
      }
    ],
    "outbounds": [
      { "protocol": "freedom", "tag": "direct" }
    ]
  }
  

客户端日志

Details

  Xray 26.1.31 (windows/amd64)
  ...
  [Info] transport/internet/splithttp: XHTTP is dialing to tcp:SERVER_IP:14183, mode auto, HTTP version 2, host www.suny.edu
  [Info] proxy/vless/outbound: tunneling request to tcp:www.google.com:443 via SERVER_IP:14183
  [Info] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: connection ends > proxy/vless/outbound: failed to decode response header > proxy/vless/encoding: unexpected
  response version. Expecting 0 but actually 88
  

服务端日志

Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions