mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-12 03:40:29 +00:00
fix: http server does not handle http2 logic correctly
This commit is contained in:
@@ -28,8 +28,6 @@ import (
|
||||
"github.com/gobwas/ws"
|
||||
"github.com/gobwas/ws/wsutil"
|
||||
"github.com/sagernet/cors"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -215,11 +213,10 @@ func startTLS(cfg *Config) {
|
||||
}
|
||||
}
|
||||
server := &http.Server{
|
||||
// using h2c.NewHandler to ensure we can work in plain http2 and some tls conn is not *tls.Conn
|
||||
Handler: h2c.NewHandler(router(cfg.IsDebug, cfg.Secret, cfg.DohServer, cfg.Cors), &http2.Server{}),
|
||||
Handler: router(cfg.IsDebug, cfg.Secret, cfg.DohServer, cfg.Cors),
|
||||
}
|
||||
tlsServer = server
|
||||
if err = server.Serve(tlsC.NewListener(l, tlsConfig)); err != nil {
|
||||
if err = server.Serve(tlsC.NewListenerForHttps(l, server, tlsConfig)); err != nil {
|
||||
log.Errorln("External controller tls serve error: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user