1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

Add some documentation of what w does

This commit is contained in:
Carl Johnson 2022-03-28 13:00:48 -04:00
parent cd6ff5d35a
commit 6ae68402a5

View File

@ -1128,7 +1128,9 @@ func readRequest(b *bufio.Reader) (req *Request, err error) {
// underlying reader when its Close method is called.
//
// MaxBytesReader prevents clients from accidentally or maliciously
// sending a large request and wasting server resources.
// sending a large request and wasting server resources. If possible,
// it tells the ResponseWriter to close the connection after the limit
// has been reached.
func MaxBytesReader(w ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser {
if n < 0 { // Treat negative limits as equivalent to 0.
n = 0