use the QUIC versions from the quic.Config for setting Alt-Svc

This commit is contained in:
Marten Seemann
2020-10-29 13:27:14 +07:00
parent c968b18a21
commit 5d1450bee7
2 changed files with 32 additions and 5 deletions

View File

@@ -353,7 +353,7 @@ var _ = Describe("Server", func() {
Context("setting http headers", func() {
expected := http.Header{
"Alt-Svc": {`h3-29=":443"; ma=2592000,h3-32=":443"; ma=2592000`},
"Alt-Svc": {`h3-29=":443"; ma=2592000`},
}
It("sets proper headers with numeric port", func() {
@@ -386,6 +386,14 @@ var _ = Describe("Server", func() {
Expect(s.SetQuicHeaders(hdr)).To(Succeed())
Expect(hdr).To(Equal(expected))
})
It("works if the quic.Config sets QUIC versions", func() {
s.Server.Addr = ":443"
s.QuicConfig = &quic.Config{Versions: []quic.VersionNumber{quic.VersionDraft32, quic.VersionDraft29}}
hdr := http.Header{}
Expect(s.SetQuicHeaders(hdr)).To(Succeed())
Expect(hdr).To(Equal(http.Header{"Alt-Svc": {`h3-32=":443"; ma=2592000,h3-29=":443"; ma=2592000`}}))
})
})
It("errors when ListenAndServe is called with s.Server nil", func() {