XHTTP packet-up: `scMaxEachPostBytes` of 0 or a range starting at 0 (`"0-100"`) panics at the first dial; `-test` passes

Open
#7,558 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
66/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
networking

Research direction

Start with transport/internet/splithttp/dialer.go at the panic site around line 457, then trace how scMaxEachPostBytes is parsed and validated by the config builder. Check the config tests and add coverage for 0 and "0-100"; done means -test rejects these values with a config error and dialing no longer panics.

Written by the indexing model from the issue text.

Description

Integrity requirements

  • I read the issue template.
  • I confirm I read the documentation and did not pile up options.
  • Complete configs and logs are provided below.
  • I searched issues and found no similar ones.
  • Reproduced on the latest release.

Description

Version: Xray 26.11.9 (Xray, Penetrates Everything.) 676eaf6 (go1.27.3 linux/amd64), the v26.11.9 release Xray-linux-64.zip (sha256 b651f7e1d9966ee2c1b1ee1bf8b52c72771824d3065dce96bbc8bcc19ed95f82). The panic site is also unchanged on main at 919d0ae (2026-11-30).

transport/internet/splithttp/dialer.go:457 (release; :460 on main) does if scMaxEachPostBytes.From <= 0 { panic("scMaxEachPostBytes should be bigger than 0") } at dial time, but the conf builder accepts these values ("0-100", -1), and -test prints Configuration OK. A config value error should be reported when the config is loaded, not as a panic on the first connection, and the process dies for every user of that core.

Reproduction Method

Save the client config below as cfg.json and the server config as server.json (both on 127.0.0.1).

# server: xray run -c server.json ; client: xray run -c client.json, then
curl -x socks5h://127.0.0.1:10808 http://127.0.0.1:20001/

Expected result: xray run -test and xray run fail with a config error for scMaxEachPostBytes, before any connection; no panic.

(xray run -test on the client config prints Configuration OK, exit 0.)

Client config


{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 10808,
      "protocol": "socks"
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "127.0.0.1",
            "port": 20001,
            "users": [
              {
                "id": "c20965b7-c354-405b-a3ef-f886415c9181",
                "encryption": "mlkem768x25519plus.native.0rtt.nRxXGka6BdFGEXRFjltK8zrAIpkpA_I4ognJS0Vjn3ygH0QU7-gZrugt9skhLYFQCya7v1wHDth6NzuUV9Foc1u9syhDW4xSE5lxFXJMURIqAKsw2EAC9uNgCWqGX1q2_usCx9WVbIh0nheh6ahRI4M0pfkMjOQGKsVzZSxxaZABzBisKPAKApqusZphcHjIAPCASIkw47tXI2gz_BKxTsQa2XZR9tssBgOif6etOgefLMZmbFa19KpLuOUH9EAQoJmLmfSpsHFk_IGajGOQ6sNKPOguN4Jz-BtG-LuGHNtbOPqLRIEhFHicr0Yt71YOR2Z-UqkoGpR7iZcNaqGHMwt3wrwjQyXOeaAp5uIz_ats09s7A2RZcUlLUDoDLUd6t7gK-swJ2-IuUtcme5oRrrNGOjHM_dh-XsrHIHcZ0IlW-ihMp-eAb0p_S0iVc8RnLlCt9Qunvge5ymPIacB6ekeb38SmRVihwPXMywVtM0O8ODlAYQi57yrBqoAaXqyTsvZZW1zLARKSq0KLRxCsppWiH_rM7EUMA5oHxDa0hDFzu2WvXxrGiodGW_WS1aCjYrJ9Jwdna_KPA1iv3mcz5HtBmnqsBLE7ZEY5CQIHi-CViOZ4aoG2CXZFuahyTEK-JzY0EqalyQehLHkgjihq3qyYzkqoNNQf3PmMRrFj95iHqgBv5LrE77skHcwFrtVSnXhw2gcRj6ctspWAlyNAEMibPZFgpswOYaVnRNwla5cV2rl3W1NtmfpIvwQrVrlMtZMGtiOzPQRk7USHwcEs6IEcJOKKxnbDJ1wlGaUfXPmiIiKjAletE5kVvPNCabq0_voYZivMVSBsk3E0XVIxkQZybdK80RQYWoGUWizLgAAc3xIEv4wGeDaa-ukXTpaP3NdjKdVlGpeG7tieT5si7QmFLqB5kVJFYcJvE4dHOEtRIwSnNdDOvzNszjtHBJM7izmXXcONV_Ct7hRMV3hitzgFSlVuI-TMBeViHCiePTwenXJJzyyK5aQR67ETBMUd_8WHfWtDGcBPb5tJvsYzrkR2OwtTheNm-9UO8AWmhlRN59CmAERVvPOGjbpuArzCRSTHhXTOyHee7ByhSmyYkug0qkqhLBeMUwlfxVy514NkkXRjT2tPNprJu2MA8MeoCyRCFsBMpIQAnTUVineuFWdAmCC4tykFyrstuRVn9FiIAsOX2UoMSMsBG-EyK1prbfdaWIk3lmUeRJddUHtuzsmhssw1NhZsj8BIAzgRSyNoACyUN1SZ15az3lzILJcQ6oYZwdw22sKrnbF9SdfIpeytF2I0MFhGdYGmC8wnUQIfAAS6Hmu8xJUww8yLV3y0gqJJu3ZZmScR5sNKK8bKotkgBhVc2eAZEesBsst4HfqG9dMusSg1CgynrNcqfVwUnMNjtpMoYnbFBjKQ6wx6guQ5YaYR12S-AeQzh9ZeEPmmLZpz00CTh2FUfxg5YlSIKAwZr7KA1cxLmnuo35RgWcVhSUvK6vA10hin69S5VimHXSU840scKmN9GQmmspla0vSDWbNDin7msk1nr-PxbXrV0021EQy81R_P65A4QG4"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "xhttp",
        "xhttpSettings": {
          "path": "/p",
          "mode": "packet-up",
          "scMaxEachPostBytes": "0-100"
        }
      }
    }
  ]
}

Server config


{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 20001,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "c20965b7-c354-405b-a3ef-f886415c9181"
          }
        ],
        "decryption": "mlkem768x25519plus.native.600s.mKKB2hh6ttyVKwqg9SccKO1WYEAP8KmAiIBRYDTBrton62Xv7UIKMjjzxjsoAC_oAb7uENPtbKTTMPptqDe5OA"
      },
      "streamSettings": {
        "network": "xhttp",
        "xhttpSettings": {
          "path": "/p"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

Client log

Full output of the panicking process (ends with the exit code):


Xray 26.11.9 (Xray, Penetrates Everything.) 676eaf6 (go1.27.3 linux/amd64)
A unified platform for anti-censorship.
[Info] infra/conf/serial: Reading config: &{Name:/tmp/repro/cfg/scmax-run.json Format:json}
[Warning] core: Xray 26.11.9 started
from tcp:127.0.0.1:58278 accepted tcp:127.0.0.1:20001
panic: `scMaxEachPostBytes` should be bigger than 0

goroutine 50 [running]:
github.com/xtls/xray-core/transport/internet/splithttp.Dial({0x24c9158, 0x381d77c5590}, {{0x24c9628, 0x381d791adb8}, 0x4e21, 0x2}, 0x381d77c6f50)
github.com/xtls/xray-core/transport/internet/splithttp/dialer.go:457 +0x1979
github.com/xtls/xray-core/transport/internet.Dial({0x24c9158, 0x381d77c5590}, {{0x24c9628?, 0x381d791adb8?}, 0x78f8?, 0x759d?}, 0x381d79961e0?)
github.com/xtls/xray-core/transport/internet/dialer.go:63 +0x168
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dial(0x381d796fc80, {0x24c9158?, 0x381d77c5590?}, {{0x24c9628?, 0x381d791adb8?}, 0xfeb0?, 0x0?})
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:275 +0x11d
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process.func2()
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:192 +0x4c
github.com/xtls/xray-core/common/retry.(*retryer).On(0x381d78c7578, 0x381d78c75c0)
github.com/xtls/xray-core/common/retry/retry.go:27 +0xc3
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process(0x381d7996690, {0x24c9158, 0x381d77c5590}, 0x381d797c140, {0x24c7308, 0x381d796fc80})
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:190 +0x3a5
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dispatch(0x381d796fc80, {0x24c9158, 0x381d77c5590}, 0x381d797c140)
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:239 +0x98a
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).routedDispatch(0x381d79964b0, {0x24c9158, 0x381d77c5590}, 0x381d797c140, {{0x24c9628, 0x381d75b41b4}, 0x4e21, 0x2})
github.com/xtls/xray-core/app/dispatcher/default.go:507 +0xc52
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).DispatchLink(0x381d79964b0, {0x24c9158, 0x381d77c5590}, {{0x24c9628?, 0x381d75b41b4?}, 0x8?, 0x381?}, 0x381d797c140)
github.com/xtls/xray-core/app/dispatcher/default.go:344 +0x506
github.com/xtls/xray-core/common/mux.(*Server).DispatchLink(0x20?, {0x24c9158?, 0x381d77c5590?}, {{0x24c9628?, 0x381d75b41b4?}, 0xc080?, 0x381?}, 0x2?)
github.com/xtls/xray-core/common/mux/server.go:64 +0xda
github.com/xtls/xray-core/proxy/socks.(*Server).processTCP(0x381d7973710, {0x24c9158, 0x381d77c45d0}, {0x759d72b4d0f0, 0x381d7682010}, {0x24ca4f0, 0x381d75fca50}, {0x381d75b41a8, 0x1, 0x1})
github.com/xtls/xray-core/proxy/socks/server.go:157 +0xf4b
github.com/xtls/xray-core/proxy/socks.(*Server).Process(0x381d7973710, {0x24c9158, 0x381d77c45d0}, 0x2, {0x759d72b4d0f0, 0x381d7682010}, {0x24ca4f0, 0x381d75fca50})
github.com/xtls/xray-core/proxy/socks/server.go:91 +0x2a5
github.com/xtls/xray-core/app/proxyman/inbound.(*tcpWorker).callback(0x381d7998000, {0x759d72b4d0f0, 0x381d7682010})
github.com/xtls/xray-core/app/proxyman/inbound/worker.go:123 +0xde3
created by github.com/xtls/xray-core/app/proxyman/inbound.(*tcpWorker).Start.func1 in goroutine 81
github.com/xtls/xray-core/app/proxyman/inbound/worker.go:142 +0x86
exit=2

Server log

Server started normally, no warnings (loglevel: warning).

Dominant language
Go
Stars
43.3k
Forks
6.2k
Avg merge
2d 11h
Merged PRs (30d)
55

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from XTLS/Xray-core

All issues in XTLS/Xray-core

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.