rpc: limit chunked requests (#16343)
This commit is contained in:
parent
e506d384e9
commit
e9b5e22ad1
|
@ -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 New Issue