aboutsummaryrefslogtreecommitdiff
path: root/http_test.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-12-06 14:48:36 +0100
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-12-06 14:48:36 +0100
commit4aadf9a85e1fd9d653e8f5c05d3825f8369fd63e (patch)
tree81376e80f7ae1fae17458ab3fe7319c944fa348f /http_test.go
parentAdd trailer support (#1165) (diff)
downloadfasthttp-4aadf9a85e1fd9d653e8f5c05d3825f8369fd63e.tar.gz
fasthttp-4aadf9a85e1fd9d653e8f5c05d3825f8369fd63e.tar.bz2
fasthttp-4aadf9a85e1fd9d653e8f5c05d3825f8369fd63e.zip
Fix parseTrailer panic
Diffstat (limited to 'http_test.go')
-rw-r--r--http_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/http_test.go b/http_test.go
index 978703a..9a6470b 100644
--- a/http_test.go
+++ b/http_test.go
@@ -16,6 +16,16 @@ import (
"github.com/valyala/bytebufferpool"
)
+func TestInvalidTrailers(t *testing.T) {
+ t.Parallel()
+
+ br := bufio.NewReader(bytes.NewReader([]byte{0x20, 0x30, 0x0a, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0xff, 0x0a, 0x0a, 0x30, 0x0d, 0x0a, 0x30}))
+ err := (&Response{}).Read(br)
+ if err == io.EOF {
+ t.Fatal(err)
+ }
+}
+
func TestResponseEmptyTransferEncoding(t *testing.T) {
t.Parallel()