mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 01:41:36 +00:00
rpc: limit chunked requests (#16343)
This commit is contained in:
parent
e506d384e9
commit
e9b5e22ad1
1 changed files with 2 additions and 1 deletions
|
|
@ -169,7 +169,8 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
// All checks passed, create a codec that reads direct from the request body
|
// All checks passed, create a codec that reads direct from the request body
|
||||||
// untilEOF and writes the response to w and order the server to process a
|
// untilEOF and writes the response to w and order the server to process a
|
||||||
// single request.
|
// single request.
|
||||||
codec := NewJSONCodec(&httpReadWriteNopCloser{r.Body, w})
|
body := io.LimitReader(r.Body, maxRequestContentLength)
|
||||||
|
codec := NewJSONCodec(&httpReadWriteNopCloser{body, w})
|
||||||
defer codec.Close()
|
defer codec.Close()
|
||||||
|
|
||||||
w.Header().Set("content-type", contentType)
|
w.Header().Set("content-type", contentType)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue