From d3d7998756c33f69706488cade1cd2b9b10a4c7f Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Mon, 11 Jul 2022 09:49:14 -0700 Subject: [PATCH] net/http: clarify that MaxBytesReader returns *MaxBytesError A MaxBytesReader returns a *MaxBytesError when reading beyond its limit, not a MaxBytesError. Fixes #53764. Change-Id: Icac3aeac96fd8b172f951241f8f111cda633752c Reviewed-on: https://go-review.googlesource.com/c/go/+/416914 Reviewed-by: Ian Lance Taylor Run-TryBot: Damien Neil TryBot-Result: Gopher Robot --- src/net/http/request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/http/request.go b/src/net/http/request.go index d091f3c056..cead91d3d4 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -1126,8 +1126,8 @@ func readRequest(b *bufio.Reader) (req *Request, err error) { // MaxBytesReader is similar to io.LimitReader but is intended for // limiting the size of incoming request bodies. In contrast to // io.LimitReader, MaxBytesReader's result is a ReadCloser, returns a -// MaxBytesError for a Read beyond the limit, and closes the -// underlying reader when its Close method is called. +// non-nil error of type *MaxBytesError for a Read beyond the limit, +// and closes the underlying reader when its Close method is called. // // MaxBytesReader prevents clients from accidentally or maliciously // sending a large request and wasting server resources. If possible,