fix support for version 30

fixes #101, ref #70
This commit is contained in:
Lucas Clemente
2016-05-15 19:58:34 +02:00
parent d469a19b62
commit 93c52a3414
2 changed files with 5 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ type publicHeader struct {
// WritePublicHeader writes a public header
func (h *publicHeader) WritePublicHeader(b *bytes.Buffer) error {
publicFlagByte := uint8(0x04)
publicFlagByte := uint8(0x00)
if h.VersionFlag && h.ResetFlag {
return errResetAndVersionFlagSet
}
@@ -43,7 +43,8 @@ func (h *publicHeader) WritePublicHeader(b *bytes.Buffer) error {
publicFlagByte |= 0x02
}
if !h.TruncateConnectionID {
publicFlagByte |= 0x08
// TODO: Change this once we support version 33 properly
publicFlagByte |= 0x0c
}
if !h.ResetFlag && !h.VersionFlag {

View File

@@ -140,12 +140,11 @@ var _ = Describe("Public Header", func() {
ConnectionID: 0x4cfa9f9b668619f6,
TruncateConnectionID: true,
PacketNumberLen: protocol.PacketNumberLen6,
PacketNumber: 1,
}
err := hdr.WritePublicHeader(b)
Expect(err).ToNot(HaveOccurred())
firstByte, _ := b.ReadByte()
Expect(firstByte & 0x08).To(BeZero())
Expect(b.Bytes()).ToNot(ContainSubstring(string([]byte{0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c})))
Expect(b.Bytes()).To(Equal([]byte{0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0}))
})
Context("GetLength", func() {