fix handling of unknown frames in the stream hijacker

This commit is contained in:
Marten Seemann
2022-05-27 17:35:00 +02:00
parent 3088865952
commit 5cb2e8265c
4 changed files with 4 additions and 8 deletions

View File

@@ -206,6 +206,7 @@ var _ = Describe("Frames", func() {
buf := &bytes.Buffer{}
quicvarint.Write(buf, 1337)
customFrameContents := []byte("custom frame")
quicvarint.Write(buf, uint64(len(customFrameContents)))
buf.Write(customFrameContents)
(&dataFrame{Length: 6}).Write(buf)
buf.WriteString("foobar")
@@ -214,10 +215,6 @@ var _ = Describe("Frames", func() {
frame, err := parseNextFrame(buf, func(ft FrameType) (hijacked bool, err error) {
Expect(ft).To(BeEquivalentTo(1337))
called = true
b := make([]byte, len(customFrameContents))
_, err = io.ReadFull(buf, b)
Expect(err).ToNot(HaveOccurred())
Expect(string(b)).To(Equal(string(customFrameContents)))
return false, nil
})
Expect(err).ToNot(HaveOccurred())