mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 00:21:30 +00:00
Fix create badhttp2 server
This commit is contained in:
parent
5af8d001ae
commit
b14ae51f71
|
@ -98,18 +98,14 @@ func (s *Server) fallbackRequest(ctx context.Context, writer http.ResponseWriter
|
|||
}
|
||||
|
||||
func (s *Server) Serve(listener net.Listener) error {
|
||||
fixTLSConfig := s.httpServer.TLSConfig == nil
|
||||
if s.httpServer.TLSConfig != nil {
|
||||
err := http2.ConfigureServer(s.httpServer, s.h2Server)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if fixTLSConfig {
|
||||
s.httpServer.TLSConfig = nil
|
||||
}
|
||||
if s.httpServer.TLSConfig == nil {
|
||||
return s.httpServer.Serve(listener)
|
||||
} else {
|
||||
return s.httpServer.ServeTLS(listener, "", "")
|
||||
} else {
|
||||
return s.httpServer.Serve(listener)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,18 +134,14 @@ func (s *Server) fallbackRequest(ctx context.Context, writer http.ResponseWriter
|
|||
}
|
||||
|
||||
func (s *Server) Serve(listener net.Listener) error {
|
||||
fixTLSConfig := s.httpServer.TLSConfig == nil
|
||||
if s.httpServer.TLSConfig != nil {
|
||||
err := http2.ConfigureServer(s.httpServer, s.h2Server)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if fixTLSConfig {
|
||||
s.httpServer.TLSConfig = nil
|
||||
}
|
||||
if s.httpServer.TLSConfig == nil {
|
||||
return s.httpServer.Serve(listener)
|
||||
} else {
|
||||
return s.httpServer.ServeTLS(listener, "", "")
|
||||
} else {
|
||||
return s.httpServer.Serve(listener)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue