From aa9682d29c572e019742c8c5354ec7d526e7210d Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Wed, 25 Jul 2018 14:40:10 +0800 Subject: [PATCH] close body after http handler finished --- handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/handler.go b/handler.go index a704976..8c9c378 100644 --- a/handler.go +++ b/handler.go @@ -263,6 +263,7 @@ func handleHTTPClient(c net.Conn, handler http.Handler) { log.Println(err) } h2conn.Run() + h2conn = nil return } @@ -284,6 +285,9 @@ func handleHTTPClient(c net.Conn, handler http.Handler) { handler.ServeHTTP(rh, req) rh.Write(nil) rh.buf.WriteTo(rh.c) + if req.Body != nil { + req.Body.Close() + } } }