Skip to content

windows httpupgrade panic #3128

Closed
Closed

Description

@FDeghy

Xray 1.8.9 (Xray, Penetrates Everything.) 37f8654 (go1.22.1 windows/amd64)

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x7827a5]

goroutine 54 [running]:
bufio.(*Writer).Flush(0xc000132f80)
bufio/bufio.go:639 +0x45
net/http.(*Request).write(0xc000342240, {0x0, 0x0}, 0x0, 0x0, 0x0)
net/http/request.go:764 +0xbd7
net/http.(*Request).Write(...)
net/http/request.go:555
github.com/xtls/xray-core/transport/internet/httpupgrade.dialhttpUpgrade({0x1658f80, 0xc000398600}, {{0x1659108, 0xc0003882a0}, 0x1f90, 0x2}, 0xc000373b80)
github.com/xtls/xray-core/transport/internet/httpupgrade/dialer.go:56 +0x8be
github.com/xtls/xray-core/transport/internet/httpupgrade.dial({0x1658f80, 0xc000398600}, {{0x1659108, 0xc0003882a0}, 0x1f90, 0x2}, 0xc000373b80)
github.com/xtls/xray-core/transport/internet/httpupgrade/dialer.go:78 +0x189
github.com/xtls/xray-core/transport/internet.Dial({0x1658f80, 0xc000398600}, {{0x1659108?, 0xc0003882a0?}, 0x82a0?, 0xc0?}, 0x0?)
github.com/xtls/xray-core/transport/internet/dialer.go:60 +0x1c7
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dial(0xc00038e700, {0x1658f80?, 0xc000398600?}, {{0x1659108, 0xc0003882a0}, 0x1f90, 0x2})
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:280 +0xa13
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process.func1()
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:85 +0xa6
github.com/xtls/xray-core/common/retry.(*retryer).On(0xc0000f3bd8, 0xc0000f3c68)
github.com/xtls/xray-core/common/retry/retry.go:27 +0xc6
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process(0xc0003981b0, {0x1658f80, 0xc000398600}, 0xc00038c140, {0x1656610, 0xc00038e700})
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:82 +0x28e
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dispatch(0xc00038e700, {0x1658f80, 0xc000398600}, 0xc00038c140)
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:206 +0x3d8
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).routedDispatch(0xc000392000, {0x1658f80, 0xc000398600}, 0xc00038c140, {{0x1658d88, 0xc000386060}, 0x1bb, 0x2})
github.com/xtls/xray-core/app/dispatcher/default.go:443 +0xca6
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).Dispatch.func1()
github.com/xtls/xray-core/app/dispatcher/default.go:266 +0x3f9
created by github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).Dispatch in goroutine 53
github.com/xtls/xray-core/app/dispatcher/default.go:239 +0x40b

Activity

  1. added
    bug
    on Mar 12, 2024
  2. RPRX commented on Mar 12, 2024

    @RPRX
    Member

    看代码是没加 TLS 时会 panic,已修复,请测试 d3a218f

  3. Fangliding commented on Mar 12, 2024

    @Fangliding
    Member

    看代码是没加 TLS 时会 panic,已修复,请测试 d3a218f

    可以考虑一下实现 httpupgrade 0-rtt 嘛()

  4. RPRX commented on Mar 12, 2024

    @RPRX
    Member

    可以考虑一下实现 httpupgrade 0-rtt 嘛()

    目测继承 conn 并重写 Read(),第一次被调用时再 http.ReadResponse() 就行,太简单了你写吧,还是 C++ 的术语方便交流

  5. added a commit that references this issue on Mar 13, 2024
  6. RPRX commented on Mar 13, 2024

    @RPRX
    Member

    可以考虑一下实现 httpupgrade 0-rtt 嘛()

    写了,但我没搭建 HTTPUpgrade 所以没测试,你们试一下 CF 接不接受它 @Fangliding @yuhan6665 @maskedeken @FDeghy

  7. maskedeken commented on Mar 13, 2024

    @maskedeken
    Contributor
  8. added a commit that references this issue on Mar 13, 2024
  9. RPRX commented on Mar 13, 2024

    @RPRX
    Member

    c144470#r139725007

    感谢,修了:5c41292

  10. RPRX commented on Mar 14, 2024

    @RPRX
    Member

    所以有人测试了 5c41292 能过 CF 吗

  11. FDeghy commented on Mar 14, 2024

    @FDeghy
    Author

    So someone has tested whether 5c41292 can pass CF?

    yes, can pass CF <3

  12. H1JK commented on Mar 15, 2024

    @H1JK
    Member

    I would like to say that HTTPUpgrade is a part of V2Fly's (or xiaokangwang's) experiment to test if WebSocket headers are used to identify proxies. To be consistent with common HTTP/1.1 connections, it should send continuous data only after receiving the server response. So enabling 0-RTT here definitely breaks the experiment.

    I think it would be better to add a option to switch if 0-RTT is enabled, and it should be turned off by default (means no 0-RTT by default to simulate common HTTP/1.1 connection).

  13. RPRX commented on Mar 16, 2024

    @RPRX
    Member

    if WebSocket headers are used to identify proxies

    细说

  14. Fangliding commented on Mar 16, 2024

    @Fangliding
    Member

    if WebSocket headers are used to identify proxies

    细说

    小绿的臆想而已 不少伊朗人都觉得http头有文章或者可以拿来大作文章(然而实际情况懂得都懂)
    httpupgrade实际上源于tor的webtunnel tor项目组也想实现类似的网页分流代理 但是他们并没有直接用ws而是自己新写了一个项目 就是我刚刚说的webtunnel 前段时间刚官宣 为了轻量就没有额外的考量了(可见说什么experiment就是扯淡 引入这个纯粹是因为占用比ws小不少) 所以v2fly的文档都写明了推荐和tls一起使用

  15. 9 remaining items

  16. added a commit that references this issue on Mar 17, 2024
  17. RPRX commented on Mar 17, 2024

    @RPRX
    Member

    @RPRX 也行不过新的ed是把数据放在哪个头里了 好像不是sec-websocket-protocol?

    HTTPUpgrade 0-RTT 的原理是“不等 Upgrade 的结果,直接发数据”(WS 协议规范有限制所以不能这么干),没放 header,无限发

    还有你文档更新早了,参考一下 #3152

  18. RPRX commented on Mar 17, 2024

    @RPRX
    Member

    @Fangliding 顺便测一下 HTTPUpgrade 不填和填 ed 时是否正常,没问题的话我准备发条频道消息

  19. jahboom commented on Mar 26, 2024

    @jahboom

    @FanglidingКстати, проверьте, нормально ли работает HTTPUpgrade, если оставить пустым и заполнить ред. Если проблем нет, я пришлю сообщение канала.

    我是否认为不支持 WebSocket 的 CDN 也无法使用 HTTPUpgrade 方法?

  20. RPRX commented on Mar 30, 2024

    @RPRX
    Member

    我是否认为不支持 WebSocket 的 CDN 也无法使用 HTTPUpgrade 方法?

    对

  21. ouilymadi9 commented on Apr 1, 2024

    @ouilymadi9

    Aide-moi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions