fix 4975: graceful server listen the specific address

This commit is contained in:
Deng Ming 2022-06-10 18:48:21 +08:00
parent 5a873ea0f0
commit 79abec4fb9
3 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# developing
- [Fix issue 4961, `leafInfo.match()` use `path.join()` to deal with `wildcardValues`, which may lead to cross directory risk ](https://github.com/beego/beego/pull/4964)
- [Fix 4975: graceful server listen the specific address](https://github.com/beego/beego/pull/4979)
# v2.0.3
- [upgrade redisgo to v1.8.8](https://github.com/beego/beego/pull/4872)
- [fix prometheus CVE-2022-21698](https://github.com/beego/beego/pull/4878)

View File

@ -169,7 +169,6 @@ func (srv *Server) ServeTLS(ln net.Listener) error {
}
go srv.handleSignals()
log.Println(os.Getpid(), srv.Addr)
return srv.internalServe(ln)
}

View File

@ -215,7 +215,8 @@ func (app *HttpServer) Run(addr string, mws ...MiddleWare) {
if app.Cfg.Listen.ListenTCP4 {
server.Network = "tcp4"
}
ln, err := net.Listen(server.Network, app.Server.Addr)
ln, err := net.Listen(server.Network, server.Addr)
logs.Info("graceful http server Running on http://%s", server.Addr)
if err != nil {
logs.Critical("Listen for HTTP[graceful mode]: ", err)
endRunning <- true