From 8c803b503c13c383577c829bf9c2007483142039 Mon Sep 17 00:00:00 2001 From: WeidiDeng Date: Thu, 17 Oct 2024 16:22:17 +0800 Subject: [PATCH] check if body is less than anticipated when there is no error reported --- modules/caddyhttp/reverseproxy/fastcgi/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/fastcgi/client.go b/modules/caddyhttp/reverseproxy/fastcgi/client.go index 18c9d0ba..b654bc84 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/client.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/client.go @@ -157,13 +157,13 @@ func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error) writer.recType = Stdin if req != nil { _, err = io.Copy(writer, req) + if err != nil { + return nil, err + } // body length mismatch if lr, ok := req.(*io.LimitedReader); ok && lr.N > 0 { return nil, io.ErrUnexpectedEOF } - if err != nil { - return nil, err - } } err = writer.FlushStream() if err != nil {