forked from quic-go/quic-go
allow PING frames at every encryption level
This commit is contained in:
@@ -101,7 +101,7 @@ func (p *frameParser) isAllowedAtEncLevel(f Frame, encLevel protocol.EncryptionL
|
|||||||
switch encLevel {
|
switch encLevel {
|
||||||
case protocol.EncryptionInitial, protocol.EncryptionHandshake:
|
case protocol.EncryptionInitial, protocol.EncryptionHandshake:
|
||||||
switch f.(type) {
|
switch f.(type) {
|
||||||
case *CryptoFrame, *AckFrame, *ConnectionCloseFrame:
|
case *CryptoFrame, *AckFrame, *ConnectionCloseFrame, *PingFrame:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
case protocol.Encryption1RTT:
|
case protocol.Encryption1RTT:
|
||||||
|
|||||||
@@ -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 {
|
for i, b := range framesSerialized {
|
||||||
_, err := parser.ParseNext(bytes.NewReader(b), protocol.EncryptionInitial)
|
_, err := parser.ParseNext(bytes.NewReader(b), protocol.EncryptionInitial)
|
||||||
switch frames[i].(type) {
|
switch frames[i].(type) {
|
||||||
case *AckFrame, *ConnectionCloseFrame, *CryptoFrame:
|
case *AckFrame, *ConnectionCloseFrame, *CryptoFrame, *PingFrame:
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
default:
|
default:
|
||||||
Expect(err).To(HaveOccurred())
|
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 {
|
for i, b := range framesSerialized {
|
||||||
_, err := parser.ParseNext(bytes.NewReader(b), protocol.EncryptionHandshake)
|
_, err := parser.ParseNext(bytes.NewReader(b), protocol.EncryptionHandshake)
|
||||||
switch frames[i].(type) {
|
switch frames[i].(type) {
|
||||||
case *AckFrame, *ConnectionCloseFrame, *CryptoFrame:
|
case *AckFrame, *ConnectionCloseFrame, *CryptoFrame, *PingFrame:
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
default:
|
default:
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
|
|||||||
Reference in New Issue
Block a user