forked from quic-go/quic-go
make sure the same session ticket key is used if none is configured
This commit is contained in:
@@ -70,6 +70,9 @@ func tlsConfigToQtlsConfig(
|
||||
if c == nil {
|
||||
c = &tls.Config{}
|
||||
}
|
||||
// Clone the config first. This executes the tls.Config.serverInit().
|
||||
// This sets the SessionTicketKey, if the user didn't supply one.
|
||||
c = c.Clone()
|
||||
// QUIC requires TLS 1.3 or newer
|
||||
minVersion := c.MinVersion
|
||||
if minVersion < qtls.VersionTLS13 {
|
||||
|
||||
@@ -63,6 +63,14 @@ var _ = Describe("qtls.Config generation", func() {
|
||||
Expect(extHandler.received).To(BeTrue())
|
||||
})
|
||||
|
||||
It("initializes such that the session ticket key remains constant", func() {
|
||||
tlsConf := &tls.Config{}
|
||||
qtlsConf1 := tlsConfigToQtlsConfig(tlsConf, nil, &mockExtensionHandler{})
|
||||
qtlsConf2 := tlsConfigToQtlsConfig(tlsConf, nil, &mockExtensionHandler{})
|
||||
Expect(qtlsConf1.SessionTicketKey).ToNot(BeZero()) // should now contain a random value
|
||||
Expect(qtlsConf1.SessionTicketKey).To(Equal(qtlsConf2.SessionTicketKey))
|
||||
})
|
||||
|
||||
Context("GetConfigForClient callback", func() {
|
||||
It("doesn't set it if absent", func() {
|
||||
qtlsConf := tlsConfigToQtlsConfig(&tls.Config{}, nil, &mockExtensionHandler{})
|
||||
|
||||
Reference in New Issue
Block a user