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

@@ -16,13 +16,8 @@ type ConnectionCloseFrame struct {
ReasonPhrase string
}
func parseConnectionCloseFrame(r *bytes.Reader, _ protocol.VersionNumber) (*ConnectionCloseFrame, error) {
typeByte, err := r.ReadByte()
if err != nil {
return nil, err
}
f := &ConnectionCloseFrame{IsApplicationError: typeByte == 0x1d}
func parseConnectionCloseFrame(r *bytes.Reader, typ uint64, _ protocol.VersionNumber) (*ConnectionCloseFrame, error) {
f := &ConnectionCloseFrame{IsApplicationError: typ == 0x1d}
ec, err := quicvarint.Read(r)
if err != nil {
return nil, err