forked from quic-go/quic-go
read connection parameters when receiving a SHLO
This commit is contained in:
@@ -226,6 +226,11 @@ func (h *cryptoSetupClient) handleSHLOMessage(cryptoData map[Tag][]byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = h.connectionParameters.SetFromMap(cryptoData)
|
||||
if err != nil {
|
||||
return qerr.InvalidCryptoMessageParameter
|
||||
}
|
||||
|
||||
h.aeadChanged <- struct{}{}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -385,6 +385,19 @@ var _ = Describe("Crypto setup", func() {
|
||||
Expect(cs.HandshakeComplete()).To(BeTrue())
|
||||
Expect(cs.aeadChanged).To(Receive())
|
||||
})
|
||||
|
||||
It("reads the connection paramaters", func() {
|
||||
tagMap[TagICSL] = []byte{3, 0, 0, 0} // 3 seconds
|
||||
err := cs.handleSHLOMessage(tagMap)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(cs.connectionParameters.GetIdleConnectionStateLifetime()).To(Equal(3 * time.Second))
|
||||
})
|
||||
|
||||
It("errors if it can't read a connection parameter", func() {
|
||||
tagMap[TagICSL] = []byte{3, 0, 0} // 1 byte too short
|
||||
err := cs.handleSHLOMessage(tagMap)
|
||||
Expect(err).To(MatchError(qerr.InvalidCryptoMessageParameter))
|
||||
})
|
||||
})
|
||||
|
||||
Context("CHLO generation", func() {
|
||||
|
||||
Reference in New Issue
Block a user