mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
parent
1712a7388f
commit
c46e93c752
5 changed files with 7 additions and 78 deletions
|
@ -97,11 +97,6 @@ func (f *AckFrameLegacy) Write(b *bytes.Buffer, version protocol.VersionNumber)
|
|||
if rangeCounter != uint8(numRanges) {
|
||||
return errors.New("BUG: Inconsistent number of NACK ranges written")
|
||||
}
|
||||
|
||||
// TODO: Remove once we drop support for <32
|
||||
if version < protocol.Version32 {
|
||||
b.WriteByte(0)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -114,7 +109,6 @@ func (f *AckFrameLegacy) MinLength(version protocol.VersionNumber) (protocol.Byt
|
|||
l += (1 + 2) * 0 /* TODO: num_timestamps */
|
||||
if f.HasNACK() {
|
||||
l += 1 + (6+1)*int(f.numWrittenNackRanges())
|
||||
l++ // TODO: Remove once we drop support for <32
|
||||
}
|
||||
return protocol.ByteCount(l), nil
|
||||
}
|
||||
|
@ -257,21 +251,6 @@ func ParseAckFrameLegacy(r *bytes.Reader, version protocol.VersionNumber) (*AckF
|
|||
frame.NackRanges = append(frame.NackRanges, nackRange)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remove once we drop support for versions <32
|
||||
if version < protocol.Version32 {
|
||||
numRevived, err := r.ReadByte()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := uint8(0); i < numRevived; i++ {
|
||||
_, err := utils.ReadUintN(r, largestObservedLen)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !frame.validateNackRanges() {
|
||||
|
|
|
@ -99,38 +99,6 @@ var _ = Describe("AckFrame", func() {
|
|||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
|
||||
Context("support for version 31", func() {
|
||||
It("support a simple ACK with one NACK range, version 31", func() {
|
||||
b := bytes.NewReader([]byte{0x60, 0x8, 0x3, 0x72, 0x1, 0x1, 0x0, 0xc0, 0x15, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0})
|
||||
frame, err := ParseAckFrameLegacy(b, protocol.Version31)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.HasNACK()).To(Equal(true))
|
||||
Expect(frame.NackRanges).To(HaveLen(1))
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(3)))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 1, LastPacketNumber: 2}))
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("support a simple ACK with multiple NACK ranges, version 31", func() {
|
||||
b := bytes.NewReader([]byte{0x60, 0x8, 0x9, 0x72, 0x1, 0x1, 0x0, 0xc0, 0x15, 0x0, 0x0, 0x2, 0x1, 0x1, 0x2, 0x0, 0x0})
|
||||
frame, err := ParseAckFrameLegacy(b, protocol.Version31)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.HasNACK()).To(Equal(true))
|
||||
Expect(frame.NackRanges).To(HaveLen(2))
|
||||
Expect(frame.LargestObserved).To(Equal(protocol.PacketNumber(9)))
|
||||
Expect(frame.NackRanges[0]).To(Equal(NackRange{FirstPacketNumber: 7, LastPacketNumber: 8}))
|
||||
Expect(frame.NackRanges[1]).To(Equal(NackRange{FirstPacketNumber: 4, LastPacketNumber: 4}))
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("reads the complete ACK frame if it contains revived packet numbers", func() {
|
||||
b := bytes.NewReader([]byte{0x60, 0x8, 0x3, 0x72, 0x1, 0x1, 0x0, 0xc0, 0x15, 0x0, 0x0, 0x1, 0x1, 0x1, 0x3, 0x5, 0x6, 0x7})
|
||||
_, err := ParseAckFrameLegacy(b, protocol.Version31)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
})
|
||||
|
||||
Context("contiguous NACK ranges", func() {
|
||||
It("parses a frame with a contiguous NACK range spanning two fields", func() {
|
||||
b := bytes.NewReader([]byte{0x64, 0x8, 0x2E, 0x01, 0x72, 0x1, 0x1, 0x0, 0xc0, 0x15, 0x0, 0x0, 0x2, 0x1, 0x2b, 0x0, 0xff})
|
||||
|
@ -324,23 +292,6 @@ var _ = Describe("AckFrame", func() {
|
|||
Expect(packetNumber).To(BeEquivalentTo([]byte{2, 0, 0, 0, 0, 0}))
|
||||
})
|
||||
|
||||
It("supports version 31", func() {
|
||||
frame := AckFrameLegacy{
|
||||
Entropy: 2,
|
||||
LargestObserved: 4,
|
||||
NackRanges: []NackRange{{FirstPacketNumber: 2, LastPacketNumber: 2}},
|
||||
}
|
||||
err := frame.Write(b, protocol.Version31)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
missingPacketBytes := b.Bytes()[b.Len()-9:]
|
||||
Expect(missingPacketBytes[0]).To(Equal(uint8(1))) // numRanges
|
||||
Expect(missingPacketBytes[7]).To(Equal(uint8(0))) // rangeLength
|
||||
packetNumber := make([]byte, 6)
|
||||
copy(packetNumber, missingPacketBytes[1:6])
|
||||
Expect(packetNumber).To(BeEquivalentTo([]byte{2, 0, 0, 0, 0, 0}))
|
||||
Expect(b.Bytes()[b.Len()-1]).To(BeZero())
|
||||
})
|
||||
|
||||
It("writes a frame with multiple NACK ranges", func() {
|
||||
nackRange1 := NackRange{FirstPacketNumber: 4, LastPacketNumber: 6}
|
||||
nackRange2 := NackRange{FirstPacketNumber: 2, LastPacketNumber: 2}
|
||||
|
@ -518,7 +469,7 @@ var _ = Describe("AckFrame", func() {
|
|||
LargestObserved: 4,
|
||||
NackRanges: []NackRange{{FirstPacketNumber: 2, LastPacketNumber: 2}},
|
||||
}
|
||||
err := f.Write(b, protocol.Version31)
|
||||
err := f.Write(b, protocol.Version33)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(f.MinLength(0)).To(Equal(protocol.ByteCount(b.Len())))
|
||||
})
|
||||
|
@ -529,7 +480,7 @@ var _ = Describe("AckFrame", func() {
|
|||
LargestObserved: 3000,
|
||||
NackRanges: []NackRange{{FirstPacketNumber: 2, LastPacketNumber: 2000}},
|
||||
}
|
||||
err := f.Write(b, protocol.Version31)
|
||||
err := f.Write(b, protocol.Version33)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(f.MinLength(0)).To(Equal(protocol.ByteCount(b.Len())))
|
||||
})
|
||||
|
|
|
@ -163,7 +163,7 @@ var _ = Describe("H2 server", func() {
|
|||
|
||||
Context("setting http headers", func() {
|
||||
expected := http.Header{
|
||||
"Alt-Svc": {`quic=":443"; ma=2592000; v="34,33,32,31"`},
|
||||
"Alt-Svc": {`quic=":443"; ma=2592000; v="34,33,32"`},
|
||||
"Alternate-Protocol": {`443:quic`},
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ type VersionNumber int
|
|||
|
||||
// The version numbers, making grepping easier
|
||||
const (
|
||||
Version31 VersionNumber = 31 + iota
|
||||
Version32
|
||||
Version32 VersionNumber = 32 + iota
|
||||
Version33
|
||||
Version34
|
||||
VersionWhatever = 0 // for when the version doesn't matter
|
||||
|
@ -20,7 +19,7 @@ const (
|
|||
|
||||
// SupportedVersions lists the versions that the server supports
|
||||
var SupportedVersions = []VersionNumber{
|
||||
Version31, Version32, Version33, Version34,
|
||||
Version32, Version33, Version34,
|
||||
}
|
||||
|
||||
// SupportedVersionsAsTags is needed for the SHLO crypto message
|
||||
|
|
|
@ -17,11 +17,11 @@ var _ = Describe("Version", func() {
|
|||
})
|
||||
|
||||
It("has proper tag list", func() {
|
||||
Expect(SupportedVersionsAsTags).To(Equal([]byte("Q031Q032Q033Q034")))
|
||||
Expect(SupportedVersionsAsTags).To(Equal([]byte("Q032Q033Q034")))
|
||||
})
|
||||
|
||||
It("has proper version list", func() {
|
||||
Expect(SupportedVersionsAsString).To(Equal("34,33,32,31"))
|
||||
Expect(SupportedVersionsAsString).To(Equal("34,33,32"))
|
||||
})
|
||||
|
||||
It("recognizes supported versions", func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue