From ce0b1f2736703221947d22288bc859a752516240 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 16 Jul 2019 18:45:51 +0700 Subject: [PATCH] fix crash when the server disabled session resumption --- go.mod | 2 +- go.sum | 4 +-- integrationtests/self/resumption_test.go | 38 ++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a9b83f07e..15a9b90d0 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/mock v1.2.0 github.com/golang/protobuf v1.3.0 github.com/marten-seemann/qpack v0.1.0 - github.com/marten-seemann/qtls v0.3.1 + github.com/marten-seemann/qtls v0.3.2 github.com/onsi/ginkgo v1.7.0 github.com/onsi/gomega v1.4.3 golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 diff --git a/go.sum b/go.sum index c08ad41cd..5c0185ccb 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/marten-seemann/qpack v0.1.0 h1:/0M7lkda/6mus9B8u34Asqm8ZhHAAt9Ho0vniNuVSVg= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= -github.com/marten-seemann/qtls v0.3.1 h1:ySYIvhFjFY2JsNHY6VACvomMEDy3EvdPA6yciUFAiHw= -github.com/marten-seemann/qtls v0.3.1/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= +github.com/marten-seemann/qtls v0.3.2 h1:O7awy4bHEzSX/K3h+fZig3/Vo03s/RxlxgsAk9sYamI= +github.com/marten-seemann/qtls v0.3.2/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/integrationtests/self/resumption_test.go b/integrationtests/self/resumption_test.go index 4b1eecc51..0ab8b434f 100644 --- a/integrationtests/self/resumption_test.go +++ b/integrationtests/self/resumption_test.go @@ -84,4 +84,42 @@ var _ = Describe("TLS session resumption", func() { Expect(err).ToNot(HaveOccurred()) Expect(serverSess.ConnectionState().DidResume).To(BeTrue()) }) + + It("doesn't use session resumption, if the config disables it", func() { + sConf := getTLSConfig() + sConf.SessionTicketsDisabled = true + server, err := quic.ListenAddr("localhost:0", sConf, nil) + Expect(err).ToNot(HaveOccurred()) + defer server.Close() + + gets := make(chan string, 100) + puts := make(chan string, 100) + cache := newClientSessionCache(gets, puts) + tlsConf := getTLSClientConfig() + tlsConf.ClientSessionCache = cache + sess, err := quic.DialAddr( + fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port), + tlsConf, + nil, + ) + Expect(err).ToNot(HaveOccurred()) + Consistently(puts).ShouldNot(Receive()) + Expect(sess.ConnectionState().DidResume).To(BeFalse()) + + serverSess, err := server.Accept(context.Background()) + Expect(err).ToNot(HaveOccurred()) + Expect(serverSess.ConnectionState().DidResume).To(BeFalse()) + + sess, err = quic.DialAddr( + fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port), + tlsConf, + nil, + ) + Expect(err).ToNot(HaveOccurred()) + Expect(sess.ConnectionState().DidResume).To(BeFalse()) + + serverSess, err = server.Accept(context.Background()) + Expect(err).ToNot(HaveOccurred()) + Expect(serverSess.ConnectionState().DidResume).To(BeFalse()) + }) })