From 0d0c4f78ce76a26cb620b811d08086f073a5ed95 Mon Sep 17 00:00:00 2001 From: dingjun Date: Tue, 14 Feb 2017 18:30:31 +0800 Subject: [PATCH] fix file fd leaks --- handler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/handler.go b/handler.go index ef0267d..89da5d4 100644 --- a/handler.go +++ b/handler.go @@ -200,6 +200,9 @@ func (h *handler) isLocalRequest(r *http.Request) bool { } func pipeAndClose(r1, r2 io.ReadWriteCloser) { + defer r1.Close() + defer r2.Close() + ch := make(chan int, 2) go func() { io.Copy(r1, r2)