You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
net/http: backport fix to protect against middleware changing server response body [1.26 backport] #81946
The Handler documentation states that handlers should not modify their request: "Except for reading the body, handlers should not modify the provided Request."
CL 794640 added some hardening to the server to defend against handlers improperly changing Request.Body. While this doesn't affect well-behaved handlers, it is not unknown for programs in the wild to replace the request body without creating a new request. (See the implementation of MaxBytesHandler for the correct way to do this.)
We should backport the fix to 1.26 as a general hardening measure.
Activity
gopherbot commentedon Oct 1, 2026
Change https://go.dev/cl/843365 mentions this issue:
[release-branch.go1.26] net/http: don't rely on server request body not changinggopherbot commentedon Oct 2, 2026
Change https://go.dev/cl/843566 mentions this issue:
[release-branch.go1.26] net/http: clear io.EOF when Close drains a server request body