mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
Remove QUIC version hint
This commit is contained in:
parent
3ea7ad198f
commit
f110af917b
3 changed files with 5 additions and 28 deletions
|
@ -10,13 +10,11 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
"github.com/marten-seemann/qpack"
|
||||
"github.com/onsi/ginkgo"
|
||||
|
@ -58,8 +56,6 @@ type Server struct {
|
|||
listeners map[*quic.Listener]struct{}
|
||||
closed utils.AtomicBool
|
||||
|
||||
supportedVersionsAsString string
|
||||
|
||||
logger utils.Logger
|
||||
}
|
||||
|
||||
|
@ -326,15 +322,7 @@ func (s *Server) SetQuicHeaders(hdr http.Header) error {
|
|||
atomic.StoreUint32(&s.port, port)
|
||||
}
|
||||
|
||||
if s.supportedVersionsAsString == "" {
|
||||
var versions []string
|
||||
for _, v := range protocol.SupportedVersions {
|
||||
versions = append(versions, v.ToAltSvc())
|
||||
}
|
||||
s.supportedVersionsAsString = strings.Join(versions, ",")
|
||||
}
|
||||
|
||||
hdr.Add("Alt-Svc", fmt.Sprintf(`%s=":%d"; ma=2592000; quic="%s"`, nextProtoH3, port, s.supportedVersionsAsString))
|
||||
hdr.Add("Alt-Svc", fmt.Sprintf(`%s=":%d"; ma=2592000`, nextProtoH3, port))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -9,13 +9,11 @@ import (
|
|||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
mockquic "github.com/lucas-clemente/quic-go/internal/mocks/quic"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/testdata"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
"github.com/marten-seemann/qpack"
|
||||
|
@ -328,19 +326,15 @@ var _ = Describe("Server", func() {
|
|||
Context("setting http headers", func() {
|
||||
var expected http.Header
|
||||
|
||||
getExpectedHeader := func(versions []protocol.VersionNumber) http.Header {
|
||||
var versionsAsString []string
|
||||
for _, v := range versions {
|
||||
versionsAsString = append(versionsAsString, v.ToAltSvc())
|
||||
}
|
||||
getExpectedHeader := func() http.Header {
|
||||
return http.Header{
|
||||
"Alt-Svc": {fmt.Sprintf(`%s=":443"; ma=2592000; quic="%s"`, nextProtoH3, strings.Join(versionsAsString, ","))},
|
||||
"Alt-Svc": {fmt.Sprintf(`%s=":443"; ma=2592000`, nextProtoH3)},
|
||||
}
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
Expect(getExpectedHeader([]protocol.VersionNumber{0x00000001, 0x1abadaba})).To(Equal(http.Header{"Alt-Svc": {nextProtoH3 + `=":443"; ma=2592000; quic="1,1abadaba"`}}))
|
||||
expected = getExpectedHeader(protocol.SupportedVersions)
|
||||
Expect(getExpectedHeader()).To(Equal(http.Header{"Alt-Svc": {nextProtoH3 + `=":443"; ma=2592000`}}))
|
||||
expected = getExpectedHeader()
|
||||
})
|
||||
|
||||
It("sets proper headers with numeric port", func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue