From d91da7401ba92e4300295f2eb5be400d0f019f2d Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 15 Oct 2019 10:17:02 -0700 Subject: [PATCH] allow PING frames at every encryption level --- internal/wire/frame_parser.go | 2 +- internal/wire/frame_parser_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/wire/frame_parser.go b/internal/wire/frame_parser.go index da775f8cd..60b5dc1bf 100644 --- a/internal/wire/frame_parser.go +++ b/internal/wire/frame_parser.go @@ -101,7 +101,7 @@ func (p *frameParser) isAllowedAtEncLevel(f Frame, encLevel protocol.EncryptionL switch encLevel { case protocol.EncryptionInitial, protocol.EncryptionHandshake: switch f.(type) { - case *CryptoFrame, *AckFrame, *ConnectionCloseFrame: + case *CryptoFrame, *AckFrame, *ConnectionCloseFrame, *PingFrame: return true } case protocol.Encryption1RTT: diff --git a/internal/wire/frame_parser_test.go b/internal/wire/frame_parser_test.go index 7aa0b435b..b99c60065 100644 --- a/internal/wire/frame_parser_test.go +++ b/internal/wire/frame_parser_test.go @@ -321,11 +321,11 @@ var _ = Describe("Frame parsing", func() { } }) - It("rejects all frames but ACK, CRYPTO and CONNECTION_CLOSE in Initial packets", func() { + It("rejects all frames but ACK, CRYPTO, PING and CONNECTION_CLOSE in Initial packets", func() { for i, b := range framesSerialized { _, err := parser.ParseNext(bytes.NewReader(b), protocol.EncryptionInitial) switch frames[i].(type) { - case *AckFrame, *ConnectionCloseFrame, *CryptoFrame: + case *AckFrame, *ConnectionCloseFrame, *CryptoFrame, *PingFrame: Expect(err).ToNot(HaveOccurred()) default: Expect(err).To(HaveOccurred()) @@ -334,11 +334,11 @@ var _ = Describe("Frame parsing", func() { } }) - It("rejects all frames but ACK, CRYPTO and CONNECTION_CLOSE in Handshake packets", func() { + It("rejects all frames but ACK, CRYPTO, PING and CONNECTION_CLOSE in Handshake packets", func() { for i, b := range framesSerialized { _, err := parser.ParseNext(bytes.NewReader(b), protocol.EncryptionHandshake) switch frames[i].(type) { - case *AckFrame, *ConnectionCloseFrame, *CryptoFrame: + case *AckFrame, *ConnectionCloseFrame, *CryptoFrame, *PingFrame: Expect(err).ToNot(HaveOccurred()) default: Expect(err).To(HaveOccurred())