From 239e3cf17c7768ea939849437855865743bca8ea Mon Sep 17 00:00:00 2001 From: kinggo Date: Wed, 21 Dec 2022 22:32:26 +0800 Subject: [PATCH] optimize: allow http head when use getonly --- http.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http.go b/http.go index 25defadd70..3d1429c730 100644 --- a/http.go +++ b/http.go @@ -1129,7 +1129,7 @@ func (req *Request) readLimitBody(r *bufio.Reader, maxBodySize int, getOnly bool // Do not reset the request here - the caller must reset it before // calling this method. - if getOnly && !req.Header.IsGet() { + if getOnly && !req.Header.IsGet() && !req.Header.IsHead() { return ErrGetOnly } @@ -1147,7 +1147,7 @@ func (req *Request) readBodyStream(r *bufio.Reader, maxBodySize int, getOnly boo // Do not reset the request here - the caller must reset it before // calling this method. - if getOnly && !req.Header.IsGet() { + if getOnly && !req.Header.IsGet() && !req.Header.IsHead() { return ErrGetOnly }