Skip to content

BUG: sing-box xhttp #47

@qr243vbi

Description

@qr243vbi

Describe the problem

NekoBox issue code 62, Error with testing profiles, xhttp issue

The issue related to xhhtp transport protocol. Thanks to your work, support for xhttp has been added to sing-box. However, there is some issues related to xhttp. Thank you for your hard work, please, help me solve some problems

Expected behavior:
Here is one of those example profiles:
vless://1ad30723-7772-4d8b-855e-933650f6906b@94.182.149.197:52952?security=reality&sni=www.varzesh3.com&fp=chrome&pbk=5bgoms49YpXoZJwtyrij9wbIq9Qe68APgIjK-J-x-g4&sid=cf8d48a6&type=xhttp&path=/&host=/?BIA_TELEGRAM@MARAMBASHI_MARAMBASHI_MARAMBASHI_MARAMBASHI_MARAMBASHI&mode=auto&packetEncoding=xudp&encryption=none#@MARAMBASHI%20%F0%9F%A5%B6

Also this is sing-box outbound config:

        {
            "flow": "",
            "packet_encoding": "xudp",
            "server": "94.182.149.197",
            "server_port": 52952,
            "tag": "proxy",
            "tls": {
                "enabled": true,
                "reality": {
                    "enabled": true,
                    "public_key": "5bgoms49YpXoZJwtyrij9wbIq9Qe68APgIjK-J-x-g4",
                    "short_id": "cf8d48a6"
                },
                "server_name": "www.varzesh3.com",
                "utls": {
                    "enabled": true,
                    "fingerprint": "chrome"
                }
            },
            "transport": {
                "host": "/?BIA_TELEGRAM@MARAMBASHI_MARAMBASHI_MARAMBASHI_MARAMBASHI_MARAMBASHI",
                "mode": "auto",
                "path": "/",
                "type": "xhttp"
            },
            "type": "vless",
            "uuid": "1ad30723-7772-4d8b-855e-933650f6906b"
        }

Everything should work well

Actual behavior:
sing-box crashes

How to reproduce

  1. Download NekoBox
  2. Launch
  3. Add profile from clipboard
  4. Click Test Profile

log

INFO[0000] network: updated default interface Ethernet 4, index 16
INFO[0000] sing-box started (0.99s)
INFO[0000] outbound/vless[proxy]: outbound connection to cp.cloudflare.com:80
DEBUG[0000] XHTTP is dialing to tcp:94.182.149.197:52952, mode stream-one, HTTP version 2, host /?BIA_TELEGRAM@MARAMBASHI_MARAMBASHI_MARAMBASHI_MARAMBASHI_MARAMBASHI
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x68 pc=0x115b42a]

goroutine 10 [running]:
github.com/sagernet/sing-box/option.(*V2RayXHTTPBaseOptions).GetRequestHeader(0xc0000a9280, {0xc000146060, 0x54})
	github.com/sagernet/sing-box@v1.12.22/option/v2ray_transport.go:186 +0x20a
github.com/sagernet/sing-box/transport/v2rayxhttp.(*DefaultDialerClient).OpenStream(0xc000406000, {0x249fc60, 0xc00054e5a0}, {0xc000146060, 0x54}, {0x248aba0, 0xc00043c660}, 0x0)
	github.com/sagernet/sing-box@v1.12.22/transport/v2rayxhttp/dialer.go:65 +0x2d5
github.com/sagernet/sing-box/transport/v2rayxhttp.(*Client).DialContext(0xc0000a9300, {0x249fc60, 0xc00054e5a0})
	github.com/sagernet/sing-box@v1.12.22/transport/v2rayxhttp/client.go:223 +0xabe
github.com/sagernet/sing-box/protocol/vless.(*vlessDialer).DialContext(0xc000000700, {0x249fc98?, 0xc000452a50?}, {0x2187d26, 0x3}, {{{0x0, 0x0}, {0x0}
}, 0x50
, {0xc00040e078, ...}})
	github.com/sagernet/sing-box@v1.12.22/protocol/vless/outbound.go:142 +0x135
github.com/sagernet/sing-box/protocol/vless.(*Outbound).DialContext(0xc000000700, {0x249fc98, 0xc000452a50}, {
0x2187d26, 0x3}, {{{0x0, 0x0}, {0x0}}, 0x50, {0xc00040e078, ...}})
	github.com/sagernet/sing-box@v1.12.22/protocol/vless/outbound.go:98 +0x5de
main.BatchURLTest.func1.1({0x249fc98, 0xc000452a50}, {0x118?, 0x319cf60?}, {0xc00040e078?, 0xc000519a18?})
	nekobox_core/test_utils.go:143 +0xc5
net/http.(*Transport).dial(0x0?, {0x249fc98?, 0xc000452a50?}, {0x2187d26?, 0x0?}, {0xc00040e078?, 0x0?})
	net/http/transport.go:1278 +0xd2
net/http.(*Transport).dialConn(0xc000418000, {0x249fc98, 0xc000452a50}, {{}, 0x0, {0xc0003ab220, 0x4}, {0xc00040e078, 0x14}, 0x0})
	net/http/transport.go:1783 +0x7e5
net/http.(*Transport).dialConnFor(0xc000418000, 0xc0000c8b00)
	net/http/transport.go:1618 +0xb8
net/http.(*Transport).startDialConnForLocked.func1()
	net/http/transport.go:1600 +0x35
created by net/http.(*Transport).startDialConnForLocked in goroutine 9
net/http/transport.go:1599 +0x112
[Error] Core: LibcoreService error: No more data to read.
URL test finished!
[Fatal] Core exited, cleaning up...
[Warn] Restarting the core ...
2026/02/20 18:40:09 [restoreSystemDNS] no action needed
sing-box: v1.12.22
2026/02/20 18:40:09 Ruleset dir is C:/NekoBox/settings/rule_sets
Core listening at 127.0.0.1:59236

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions