mirror of
https://gitee.com/johng/gf.git
synced 2024-11-29 18:57:44 +08:00
improve ghttp.Server by closing the request and response body to release the file descriptor in time
This commit is contained in:
parent
c7f1c881c0
commit
9f79453334
@ -73,6 +73,13 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// Close the session, which automatically update the TTL
|
||||
// of the session if it exists.
|
||||
request.Session.Close()
|
||||
|
||||
// Close the request and response body
|
||||
// to release the file descriptor in time.
|
||||
request.Request.Body.Close()
|
||||
if request.Request.Response != nil {
|
||||
request.Request.Response.Body.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
// ============================================================
|
||||
|
Loading…
Reference in New Issue
Block a user