move the unencrypted STREAM frame check from the unpacker to the session

This commit is contained in:
Marten Seemann 2018-03-25 18:33:46 +02:00
parent 6f12844094
commit 2fbc994d29
6 changed files with 38 additions and 60 deletions

View file

@ -6,6 +6,7 @@ import (
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"io"
"github.com/bifurcation/mint"
@ -123,6 +124,9 @@ func unpackInitialPacket(aead crypto.AEAD, hdr *wire.Header, data []byte, versio
if frame == nil {
return nil, errors.New("Packet doesn't contain a STREAM_FRAME")
}
if frame.StreamID != version.CryptoStreamID() {
return nil, fmt.Errorf("Received STREAM_FRAME for wrong stream (Stream ID %d)", frame.StreamID)
}
// We don't need a check for the stream ID here.
// The packetUnpacker checks that there's no unencrypted stream data except for the crypto stream.
if frame.Offset != 0 {