reject RST_STREAM frames for the crypto stream

This commit is contained in:
Marten Seemann
2017-12-10 23:11:26 +07:00
parent 81e13e52fd
commit dfa2181657
2 changed files with 11 additions and 0 deletions

View File

@@ -602,6 +602,9 @@ func (s *session) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) error
}
func (s *session) handleRstStreamFrame(frame *wire.RstStreamFrame) error {
if frame.StreamID == s.version.CryptoStreamID() {
return errors.New("Received RST_STREAM frame for the crypto stream")
}
str, err := s.streamsMap.GetOrOpenStream(frame.StreamID)
if err != nil {
return err

View File

@@ -392,6 +392,14 @@ var _ = Describe("Session", func() {
}}, protocol.EncryptionUnspecified)
Expect(err).NotTo(HaveOccurred())
})
It("erros when a RST_STREAM frame would reset the crypto stream", func() {
err := sess.handleRstStreamFrame(&wire.RstStreamFrame{
StreamID: sess.version.CryptoStreamID(),
ErrorCode: 123,
})
Expect(err).To(MatchError("Received RST_STREAM frame for the crypto stream"))
})
})
Context("handling MAX_DATA and MAX_STREAM_DATA frames", func() {