Skip to content

Commit

Permalink
Merge branch 'valyala:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tylitianrui committed Jan 17, 2024
2 parents 3866e94 + c205a25 commit 736ac22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ This is an **unsafe** way, the result string and `[]byte` buffer share the same

* *Which GO versions are supported by fasthttp?*

Go 1.15.x. Older versions won't be supported.
Go 1.18.x. Older versions won't be supported.

* *Please provide real benchmark data and server information*

Expand Down
8 changes: 8 additions & 0 deletions fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func FuzzResponseReadLimitBody(f *testing.F) {
f.Add([]byte("HTTP/1.1 200 OK\r\nContent-Type: aa\r\nContent-Length: 10\r\n\r\n9876543210"), 1024*1024)

f.Fuzz(func(t *testing.T, body []byte, max int) {
if max > 10*1024*1024 { // Skip limits higher than 10MB.
return
}

_ = res.ReadLimitBody(bufio.NewReader(bytes.NewReader(body)), max)
w := bytes.Buffer{}
_, _ = res.WriteTo(&w)
Expand All @@ -67,6 +71,10 @@ func FuzzRequestReadLimitBody(f *testing.F) {
f.Add([]byte("POST /a HTTP/1.1\r\nHost: a.com\r\nTransfer-Encoding: chunked\r\nContent-Type: aa\r\n\r\n6\r\nfoobar\r\n3\r\nbaz\r\n0\r\nfoobar\r\n\r\n"), 1024*1024)

f.Fuzz(func(t *testing.T, body []byte, max int) {
if max > 10*1024*1024 { // Skip limits higher than 10MB.
return
}

_ = req.ReadLimitBody(bufio.NewReader(bytes.NewReader(body)), max)
w := bytes.Buffer{}
_, _ = req.WriteTo(&w)
Expand Down

0 comments on commit 736ac22

Please sign in to comment.