forked from quic-go/quic-go
@@ -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,30"`},
|
||||
"Alt-Svc": {`quic=":443"; ma=2592000; v="34,33,32,31"`},
|
||||
"Alternate-Protocol": {`443:quic`},
|
||||
}
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ func (h *CryptoSetup) isInchoateCHLO(cryptoData map[Tag][]byte) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (h *CryptoSetup) handleInchoateCHLO(sni string, data []byte, cryptoData map[Tag][]byte) ([]byte, error) {
|
||||
if len(data) < protocol.ClientHelloMinimumSize {
|
||||
func (h *CryptoSetup) handleInchoateCHLO(sni string, chlo []byte, cryptoData map[Tag][]byte) ([]byte, error) {
|
||||
if len(chlo) < protocol.ClientHelloMinimumSize {
|
||||
return nil, qerr.Error(qerr.CryptoInvalidValueLength, "CHLO too small")
|
||||
}
|
||||
|
||||
@@ -200,12 +200,7 @@ func (h *CryptoSetup) handleInchoateCHLO(sni string, data []byte, cryptoData map
|
||||
}
|
||||
|
||||
if h.scfg.stkSource.VerifyToken(h.ip, cryptoData[TagSTK]) == nil {
|
||||
var chloOrNil []byte
|
||||
if h.version > protocol.Version30 {
|
||||
chloOrNil = data
|
||||
}
|
||||
|
||||
proof, err := h.scfg.Sign(sni, chloOrNil)
|
||||
proof, err := h.scfg.Sign(sni, chlo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -228,13 +228,6 @@ var _ = Describe("Crypto setup", func() {
|
||||
Expect(signer.gotCHLO).To(BeTrue())
|
||||
})
|
||||
|
||||
It("generates REJ messages for version 30", func() {
|
||||
cs.version = protocol.Version30
|
||||
_, err := cs.handleInchoateCHLO("", sampleCHLO, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(signer.gotCHLO).To(BeFalse())
|
||||
})
|
||||
|
||||
It("generates SHLO messages", func() {
|
||||
response, err := cs.handleCHLO("", []byte("chlo-data"), map[Tag][]byte{
|
||||
TagPUBS: []byte("pubs-c"),
|
||||
|
||||
@@ -11,8 +11,7 @@ type VersionNumber int
|
||||
|
||||
// The version numbers, making grepping easier
|
||||
const (
|
||||
Version30 VersionNumber = 30 + iota
|
||||
Version31
|
||||
Version31 VersionNumber = 31 + iota
|
||||
Version32
|
||||
Version33
|
||||
Version34
|
||||
@@ -21,7 +20,7 @@ const (
|
||||
|
||||
// SupportedVersions lists the versions that the server supports
|
||||
var SupportedVersions = []VersionNumber{
|
||||
Version30, Version31, Version32, Version33, Version34,
|
||||
Version31, Version32, Version33, Version34,
|
||||
}
|
||||
|
||||
// SupportedVersionsAsTags is needed for the SHLO crypto message
|
||||
|
||||
@@ -8,20 +8,20 @@ import (
|
||||
var _ = Describe("Version", func() {
|
||||
It("converts tags to numbers", func() {
|
||||
Expect(VersionTagToNumber('Q' + '1'<<8 + '2'<<16 + '3'<<24)).To(Equal(VersionNumber(123)))
|
||||
Expect(VersionTagToNumber('Q' + '0'<<8 + '3'<<16 + '0'<<24)).To(Equal(Version30))
|
||||
Expect(VersionTagToNumber('Q' + '0'<<8 + '3'<<16 + '4'<<24)).To(Equal(Version34))
|
||||
})
|
||||
|
||||
It("converts number to tag", func() {
|
||||
Expect(VersionNumberToTag(VersionNumber(123))).To(Equal(uint32('Q' + '1'<<8 + '2'<<16 + '3'<<24)))
|
||||
Expect(VersionNumberToTag(Version30)).To(Equal(uint32('Q' + '0'<<8 + '3'<<16 + '0'<<24)))
|
||||
Expect(VersionNumberToTag(Version34)).To(Equal(uint32('Q' + '0'<<8 + '3'<<16 + '4'<<24)))
|
||||
})
|
||||
|
||||
It("has proper tag list", func() {
|
||||
Expect(SupportedVersionsAsTags).To(Equal([]byte("Q030Q031Q032Q033Q034")))
|
||||
Expect(SupportedVersionsAsTags).To(Equal([]byte("Q031Q032Q033Q034")))
|
||||
})
|
||||
|
||||
It("has proper version list", func() {
|
||||
Expect(SupportedVersionsAsString).To(Equal("34,33,32,31,30"))
|
||||
Expect(SupportedVersionsAsString).To(Equal("34,33,32,31"))
|
||||
})
|
||||
|
||||
It("recognizes supported versions", func() {
|
||||
|
||||
@@ -11,13 +11,13 @@ import (
|
||||
var _ = Describe("Public Header", func() {
|
||||
Context("when parsing", func() {
|
||||
It("accepts a sample client header", func() {
|
||||
b := bytes.NewReader([]byte{0x09, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0x51, 0x30, 0x33, 0x30, 0x01})
|
||||
b := bytes.NewReader([]byte{0x09, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0x51, 0x30, 0x33, 0x34, 0x01})
|
||||
hdr, err := parsePublicHeader(b)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(hdr.VersionFlag).To(BeTrue())
|
||||
Expect(hdr.ResetFlag).To(BeFalse())
|
||||
Expect(hdr.ConnectionID).To(Equal(protocol.ConnectionID(0x4cfa9f9b668619f6)))
|
||||
Expect(hdr.VersionNumber).To(Equal(protocol.Version30))
|
||||
Expect(hdr.VersionNumber).To(Equal(protocol.Version34))
|
||||
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(1)))
|
||||
Expect(b.Len()).To(BeZero())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user