chore: update to go1.19
This commit is contained in:
parent
40d2421db9
commit
45453b20fa
61 changed files with 519 additions and 493 deletions
|
@ -827,7 +827,7 @@ func BenchmarkRouterServe(b *testing.B) {
|
|||
b.Cleanup(func() { server.Close() })
|
||||
|
||||
res := &http.Response{
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
}
|
||||
|
||||
|
@ -879,7 +879,7 @@ func BenchmarkRouterServe(b *testing.B) {
|
|||
|
||||
func BenchmarkService(b *testing.B) {
|
||||
res := &http.Response{
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -109,8 +110,13 @@ func Test_Routing(t *testing.T) {
|
|||
for {
|
||||
conn, err := tcpBackendListener.Accept()
|
||||
if err != nil {
|
||||
var netErr net.Error
|
||||
if errors.As(err, &netErr) && netErr.Temporary() {
|
||||
var opErr *net.OpError
|
||||
if errors.As(err, &opErr) && opErr.Temporary() {
|
||||
continue
|
||||
}
|
||||
|
||||
var urlErr *url.Error
|
||||
if errors.As(err, &urlErr) && urlErr.Temporary() {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
stdlog "log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -195,8 +196,13 @@ func (e *TCPEntryPoint) Start(ctx context.Context) {
|
|||
if err != nil {
|
||||
logger.Error(err)
|
||||
|
||||
var netErr net.Error
|
||||
if errors.As(err, &netErr) && netErr.Temporary() {
|
||||
var opErr *net.OpError
|
||||
if errors.As(err, &opErr) && opErr.Temporary() {
|
||||
continue
|
||||
}
|
||||
|
||||
var urlErr *url.Error
|
||||
if errors.As(err, &urlErr) && urlErr.Temporary() {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func (t *staticTransport) RoundTrip(r *http.Request) (*http.Response, error) {
|
|||
|
||||
func BenchmarkProxy(b *testing.B) {
|
||||
res := &http.Response{
|
||||
StatusCode: 200,
|
||||
StatusCode: http.StatusOK,
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
}
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ func TestWebSocketUpgradeFailed(t *testing.T) {
|
|||
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/ws", func(w http.ResponseWriter, req *http.Request) {
|
||||
w.WriteHeader(400)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
})
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
mux.ServeHTTP(w, req)
|
||||
|
@ -472,7 +472,7 @@ func TestWebSocketUpgradeFailed(t *testing.T) {
|
|||
req.URL.Path = path
|
||||
f.ServeHTTP(w, req)
|
||||
} else {
|
||||
w.WriteHeader(200)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
}))
|
||||
defer proxy.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue