Merge pull request #4979 from flycash/dev

fix 4975: graceful server listen the specific address
This commit is contained in:
Ming Deng 2022-06-10 21:07:48 +08:00 committed by GitHub
commit af271bcc6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# developing # 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 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 # v2.0.3
- [upgrade redisgo to v1.8.8](https://github.com/beego/beego/pull/4872) - [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) - [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() go srv.handleSignals()
log.Println(os.Getpid(), srv.Addr)
return srv.internalServe(ln) return srv.internalServe(ln)
} }

View File

@ -215,7 +215,8 @@ func (app *HttpServer) Run(addr string, mws ...MiddleWare) {
if app.Cfg.Listen.ListenTCP4 { if app.Cfg.Listen.ListenTCP4 {
server.Network = "tcp4" 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 { if err != nil {
logs.Critical("Listen for HTTP[graceful mode]: ", err) logs.Critical("Listen for HTTP[graceful mode]: ", err)
endRunning <- true endRunning <- true