Skip to content

Commit

Permalink
Merge 5b59f4c into 918f22a
Browse files Browse the repository at this point in the history
  • Loading branch information
justxuewei authored Oct 28, 2023
2 parents 918f22a + 5b59f4c commit 60c1dcd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion protocol/jsonrpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const (
DefaultHTTPRspBufferSize = 1024
// PathPrefix ...
PathPrefix = byte('/')
// Max HTTP header size in Mib
MaxHeaderSize = 8 * 1024 * 1024
)

// Server is JSON RPC server wrapper
Expand Down Expand Up @@ -121,7 +123,7 @@ func (s *Server) handlePkg(conn net.Conn) {
}

for {
bufReader := bufio.NewReader(conn)
bufReader := bufio.NewReader(io.LimitReader(conn, MaxHeaderSize))
r, err := http.ReadRequest(bufReader)
if err != nil {
logger.Warnf("[ReadRequest] error: %v", err)
Expand Down

0 comments on commit 60c1dcd

Please sign in to comment.