add version to inchoate CHLO

This commit is contained in:
Marten Seemann
2016-11-08 16:32:13 +07:00
parent 214a37ac39
commit 17c5147aa4
2 changed files with 7 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package handshake
import (
"bytes"
"encoding/binary"
"io"
"github.com/lucas-clemente/quic-go/crypto"
@@ -82,6 +83,10 @@ func (h *cryptoSetupClient) getInchoateCHLOValues() map[Tag][]byte {
tags[TagPDMD] = []byte("X509")
tags[TagPAD] = bytes.Repeat([]byte("0"), protocol.ClientHelloMinimumSize)
versionTag := make([]byte, 4, 4)
binary.LittleEndian.PutUint32(versionTag, protocol.VersionNumberToTag(h.version))
tags[TagVER] = versionTag
return tags
}

View File

@@ -12,6 +12,7 @@ var _ = Describe("Crypto setup", func() {
BeforeEach(func() {
cs = cryptoSetupClient{
cryptoStream: &mockStream{},
version: protocol.Version36,
}
})
@@ -20,6 +21,7 @@ var _ = Describe("Crypto setup", func() {
tags := cs.getInchoateCHLOValues()
Expect(tags).To(HaveKey(TagSNI))
Expect(tags[TagPDMD]).To(Equal([]byte("X509")))
Expect(tags[TagVER]).To(Equal([]byte("Q036")))
})
It("is longer than the miminum client hello size", func() {