wire: correctly parse multi-byte frame types (#3736)

This commit is contained in:
Marten Seemann
2023-04-19 14:42:23 +02:00
committed by GitHub
parent 3f06880917
commit da26f91905
42 changed files with 262 additions and 394 deletions

View File

@@ -14,8 +14,7 @@ import (
var _ = Describe("DATA_BLOCKED frame", func() {
Context("when parsing", func() {
It("accepts sample frame", func() {
data := []byte{0x14}
data = append(data, encodeVarInt(0x12345678)...)
data := encodeVarInt(0x12345678)
b := bytes.NewReader(data)
frame, err := parseDataBlockedFrame(b, protocol.Version1)
Expect(err).ToNot(HaveOccurred())
@@ -24,8 +23,7 @@ var _ = Describe("DATA_BLOCKED frame", func() {
})
It("errors on EOFs", func() {
data := []byte{0x14}
data = append(data, encodeVarInt(0x12345678)...)
data := encodeVarInt(0x12345678)
_, err := parseDataBlockedFrame(bytes.NewReader(data), protocol.Version1)
Expect(err).ToNot(HaveOccurred())
for i := range data {