From d32681de04f9830d666d72d154295f518073fcb7 Mon Sep 17 00:00:00 2001 From: gaowenju Date: Tue, 8 Aug 2023 20:38:58 +0800 Subject: [PATCH] feat: add end chunk even if read error --- pkg/protocol/http1/ext/common.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/protocol/http1/ext/common.go b/pkg/protocol/http1/ext/common.go index 864988317..19f82e3d4 100644 --- a/pkg/protocol/http1/ext/common.go +++ b/pkg/protocol/http1/ext/common.go @@ -117,12 +117,10 @@ func WriteBodyChunked(w network.Writer, r io.Reader) error { if err == nil { panic("BUG: io.Reader returned 0, nil") } - if err == io.EOF { - if err = WriteChunk(w, buf[:0], true); err != nil { - break - } - err = nil + if err = WriteChunk(w, buf[:0], true); err != nil { + break } + err = nil break } if err = WriteChunk(w, buf[:n], true); err != nil {