check transport parameters after 0-RTT resumption (#3985)

* check new transport parameters do not contain redueced limits

* redefine ValidForUpdate and add tests

* fix test assertion and update comment
This commit is contained in:
Ameagari 2023-08-02 09:34:42 +08:00 committed by GitHub
parent f3a0ce1599
commit 1c47ebefc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 142 additions and 0 deletions

View file

@ -612,5 +612,93 @@ var _ = Describe("Transport Parameters", func() {
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
})
Context("client checks the parameters after successfully sending 0-RTT data", func() {
var p TransportParameters
saved := &TransportParameters{
InitialMaxStreamDataBidiLocal: 1,
InitialMaxStreamDataBidiRemote: 2,
InitialMaxStreamDataUni: 3,
InitialMaxData: 4,
MaxBidiStreamNum: 5,
MaxUniStreamNum: 6,
ActiveConnectionIDLimit: 7,
}
BeforeEach(func() {
p = *saved
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the InitialMaxStreamDataBidiLocal was reduced", func() {
p.InitialMaxStreamDataBidiLocal = saved.InitialMaxStreamDataBidiLocal - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the InitialMaxStreamDataBidiLocal was increased", func() {
p.InitialMaxStreamDataBidiLocal = saved.InitialMaxStreamDataBidiLocal + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the InitialMaxStreamDataBidiRemote was reduced", func() {
p.InitialMaxStreamDataBidiRemote = saved.InitialMaxStreamDataBidiRemote - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the InitialMaxStreamDataBidiRemote was increased", func() {
p.InitialMaxStreamDataBidiRemote = saved.InitialMaxStreamDataBidiRemote + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the InitialMaxStreamDataUni was reduced", func() {
p.InitialMaxStreamDataUni = saved.InitialMaxStreamDataUni - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the InitialMaxStreamDataUni was increased", func() {
p.InitialMaxStreamDataUni = saved.InitialMaxStreamDataUni + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the InitialMaxData was reduced", func() {
p.InitialMaxData = saved.InitialMaxData - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the InitialMaxData was increased", func() {
p.InitialMaxData = saved.InitialMaxData + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the MaxBidiStreamNum was reduced", func() {
p.MaxBidiStreamNum = saved.MaxBidiStreamNum - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the MaxBidiStreamNum was increased", func() {
p.MaxBidiStreamNum = saved.MaxBidiStreamNum + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the MaxUniStreamNum reduced", func() {
p.MaxUniStreamNum = saved.MaxUniStreamNum - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the MaxUniStreamNum was increased", func() {
p.MaxUniStreamNum = saved.MaxUniStreamNum + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the ActiveConnectionIDLimit reduced", func() {
p.ActiveConnectionIDLimit = saved.ActiveConnectionIDLimit - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the ActiveConnectionIDLimit increased", func() {
p.ActiveConnectionIDLimit = saved.ActiveConnectionIDLimit + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
})
})
})