Upgrade quic-go to v0.28.0

This commit is contained in:
Tom Moulard 2022-07-18 11:10:08 +02:00 committed by GitHub
parent 4dc379c601
commit cdda9a18ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 27 deletions

View file

@ -8,7 +8,6 @@ import (
"net"
"net/http"
"sync"
"time"
"github.com/lucas-clemente/quic-go/http3"
"github.com/traefik/traefik/v2/pkg/config/static"
@ -47,24 +46,17 @@ func newHTTP3Server(ctx context.Context, configuration *static.EntryPoint, https
}
h3.Server = &http3.Server{
Port: configuration.HTTP3.AdvertisedPort,
Server: &http.Server{
Addr: configuration.GetAddress(),
Handler: httpsServer.Server.(*http.Server).Handler,
ErrorLog: httpServerLogger,
ReadTimeout: time.Duration(configuration.Transport.RespondingTimeouts.ReadTimeout),
WriteTimeout: time.Duration(configuration.Transport.RespondingTimeouts.WriteTimeout),
IdleTimeout: time.Duration(configuration.Transport.RespondingTimeouts.IdleTimeout),
TLSConfig: &tls.Config{GetConfigForClient: h3.getGetConfigForClient},
},
Addr: configuration.GetAddress(),
Port: configuration.HTTP3.AdvertisedPort,
Handler: httpsServer.Server.(*http.Server).Handler,
TLSConfig: &tls.Config{GetConfigForClient: h3.getGetConfigForClient},
}
previousHandler := httpsServer.Server.(*http.Server).Handler
httpsServer.Server.(*http.Server).Handler = http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
err := h3.Server.SetQuicHeaders(rw.Header())
if err != nil {
log.FromContext(ctx).Errorf("failed to set HTTP3 headers: %v", err)
if err := h3.Server.SetQuicHeaders(rw.Header()); err != nil {
log.FromContext(ctx).Errorf("Failed to set HTTP3 headers: %v", err)
}
previousHandler.ServeHTTP(rw, req)
@ -90,3 +82,8 @@ func (e *http3server) getGetConfigForClient(info *tls.ClientHelloInfo) (*tls.Con
return e.getter(info)
}
func (e *http3server) Shutdown(_ context.Context) error {
// TODO: use e.Server.CloseGracefully() when available.
return e.Server.Close()
}