forked from quic-go/quic-go
use the correct error code when checking for encryption level boundaries
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/qerr"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
"github.com/lucas-clemente/quic-go/internal/wire"
|
||||
)
|
||||
@@ -73,7 +74,7 @@ func (s *cryptoStreamImpl) HandleCryptoFrame(f *wire.CryptoFrame) error {
|
||||
if s.finished {
|
||||
if highestOffset > s.highestOffset {
|
||||
// reject crypto data received after this stream was already finished
|
||||
return errors.New("received crypto data after change of encryption level")
|
||||
return qerr.Error(qerr.ProtocolViolation, "received crypto data after change of encryption level")
|
||||
}
|
||||
// ignore data with a smaller offset than the highest received
|
||||
// could e.g. be a retransmission
|
||||
|
||||
@@ -119,7 +119,7 @@ var _ = Describe("Crypto Stream", func() {
|
||||
err := str.HandleCryptoFrame(&wire.CryptoFrame{
|
||||
Data: createHandshakeMessage(5),
|
||||
})
|
||||
Expect(err).To(MatchError("received crypto data after change of encryption level"))
|
||||
Expect(err).To(MatchError("PROTOCOL_VIOLATION: received crypto data after change of encryption level"))
|
||||
})
|
||||
|
||||
It("ignores crypto data below the maximum offset received before finishing", func() {
|
||||
|
||||
Reference in New Issue
Block a user