From: Damien Neil Date: Mon, 11 Jul 2022 16:49:14 +0000 (-0700) Subject: net/http: clarify that MaxBytesReader returns *MaxBytesError X-Git-Tag: go1.19rc2~1^2~8 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d3d7998756;p=gostls13.git 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 --- 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,