Skip to content

Commit d3d7998

Browse files
committed
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 <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 126c22a commit d3d7998

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net/http/request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,8 @@ func readRequest(b *bufio.Reader) (req *Request, err error) {
11261126
// MaxBytesReader is similar to io.LimitReader but is intended for
11271127
// limiting the size of incoming request bodies. In contrast to
11281128
// io.LimitReader, MaxBytesReader's result is a ReadCloser, returns a
1129-
// MaxBytesError for a Read beyond the limit, and closes the
1130-
// underlying reader when its Close method is called.
1129+
// non-nil error of type *MaxBytesError for a Read beyond the limit,
1130+
// and closes the underlying reader when its Close method is called.
11311131
//
11321132
// MaxBytesReader prevents clients from accidentally or maliciously
11331133
// sending a large request and wasting server resources. If possible,

0 commit comments

Comments
 (0)