naiba / nezha

:trollface: Self-hosted, lightweight server and website monitoring and O&M tool
https://nezha.wiki
Apache License 2.0
7.27k stars 1.27k forks source link

add path check for multiplexer #451

Closed uubulb closed 3 weeks ago

uubulb commented 3 weeks ago

因h2c已经检查请求协议是否为http2了,去除了对r.ProtoMajor == 2的检查

naiba commented 3 weeks ago

h2c只是能接受h2请求,跟handler没关系吧

naiba commented 3 weeks ago

Path用下 NezhaService_ServiceDesc 变量

uubulb commented 3 weeks ago

h2c只是能接受h2请求,跟handler没关系吧

原来描述的有点模糊,是检查请求的协议 https://github.com/golang/net/blob/4783315416d92ff3d4664762748bd21776b42b98/http2/h2c/h2c.go#L83-L85

naiba commented 3 weeks ago

这个mux是不是接收两边的请求,会有h1请求进来的

On Wed, Oct 23, 2024 at 11:34 UUBulb @.***> wrote:

h2c只是能接受h2请求,跟handler没关系吧

https://github.com/golang/net/blob/4783315416d92ff3d4664762748bd21776b42b98/http2/h2c/h2c.go#L83-L85

— Reply to this email directly, view it on GitHub https://github.com/naiba/nezha/pull/451#issuecomment-2430783303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7DUMNCAGOHGUI4WGSDSSLZ44KK5AVCNFSM6AAAAABQNHFKAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZQG44DGMZQGM . You are receiving this because you commented.Message ID: @.***>

uubulb commented 3 weeks ago

这个mux是不是接收两边的请求,会有h1请求进来的

据注释说h2c handler做的就是把h2c请求劫持到h2 server(handler用的还是传入的),h1连接的话就只把请求传给传入的handler,不做额外处理

naiba commented 3 weeks ago

不是……不做额外处理为啥要重新分配h1handler和h2handler

On Wed, Oct 23, 2024 at 12:04 UUBulb @.***> wrote:

这个mux是不是接收两边的请求,会有h1请求进来的

据注释说h2c handler做的就是把h2c连接劫持到h2 server(handler用的还是传入的),h1连接的话就只把连接传给传入的handler,不做额外处理

— Reply to this email directly, view it on GitHub https://github.com/naiba/nezha/pull/451#issuecomment-2430833753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7DUMJG6GXCAKNV57QQ5XDZ44N5JAVCNFSM6AAAAABQNHFKAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZQHAZTGNZVGM . You are receiving this because you commented.Message ID: @.***>

naiba commented 3 weeks ago

直接写个poc测试下?

On Wed, Oct 23, 2024 at 12:05 William Liu @.***> wrote:

不是……不做额外处理为啥要重新分配h1handler和h2handler

On Wed, Oct 23, 2024 at 12:04 UUBulb @.***> wrote:

这个mux是不是接收两边的请求,会有h1请求进来的

据注释说h2c handler做的就是把h2c连接劫持到h2 server(handler用的还是传入的),h1连接的话就只把连接传给传入的handler,不做额外处理

— Reply to this email directly, view it on GitHub https://github.com/naiba/nezha/pull/451#issuecomment-2430833753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7DUMJG6GXCAKNV57QQ5XDZ44N5JAVCNFSM6AAAAABQNHFKAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZQHAZTGNZVGM . You are receiving this because you commented.Message ID: @.***>

uubulb commented 3 weeks ago

直接写个poc测试下?

sorry,理解错误了,他确实没影响handler的内部检查,h1还是会进grpc handler