From 39d629180fdc81da397f95c561e8efd4f4cc4099 Mon Sep 17 00:00:00 2001 From: Albert Bausili Date: Sun, 13 Sep 2026 13:10:35 +0200 Subject: [PATCH] chore(deps): golang.org/x/net 0.59.0 and x/text 0.42.0; move the test h2c clients to the stdlib transport x/net 0.59 deprecates http2.Server and http2.Transport in favour of net/http's Protocols. The std engine keeps h2c.NewHandler because the stdlib's unencrypted HTTP/2 does not perform the RFC 7540 3.2 Upgrade handshake that epoll and io_uring honour (see the import comment), so the one http2.Server literal it needs carries the same staticcheck waiver as the handler, on a single line so the waiver covers the deprecated fields. Every test client that dialled prior-knowledge h2c through http2.Transport{AllowHTTP: true, DialTLSContext: ...} now uses http.Transport with Protocols.SetUnencryptedHTTP2(true), which dials plaintext TCP through DialContext and speaks HTTP/2 from the first byte. The per-package h2cOnly helpers keep the shape in one place. Supersedes #577 (dependabot could not clear the lint gate on its own). --- adaptive/ramp_transplant_test.go | 18 ++++++---- engine/std/engine.go | 13 ++++---- go.mod | 4 +-- go.sum | 8 ++--- middleware/compress/go.mod | 4 +-- middleware/compress/go.sum | 8 ++--- middleware/metrics/go.mod | 4 +-- middleware/metrics/go.sum | 8 ++--- middleware/otel/go.mod | 4 +-- middleware/otel/go.sum | 8 ++--- middleware/protobuf/go.mod | 4 +-- middleware/protobuf/go.sum | 8 ++--- middleware/sse/sse_disconnect_linux_test.go | 17 +++++----- test/benchcmp_sse/go.mod | 4 +-- test/benchcmp_sse/go.sum | 8 ++--- test/benchcmp_ws/go.mod | 4 +-- test/benchcmp_ws/go.sum | 8 ++--- test/conformance/h2c_test.go | 13 +------- test/conformance/helper_test.go | 20 ++++++----- test/drivercmp/postgres/go.mod | 8 ++--- test/drivercmp/postgres/go.sum | 16 ++++----- test/drivercmp/redis/go.mod | 4 +-- test/drivercmp/redis/go.sum | 8 ++--- test/integration/adaptive_hybrid_test.go | 18 ++++++---- test/spec/helpers_test.go | 20 ++++++----- test/spec/integration_test.go | 37 +++++---------------- 26 files changed, 130 insertions(+), 146 deletions(-) diff --git a/adaptive/ramp_transplant_test.go b/adaptive/ramp_transplant_test.go index f7fe58e1..84188a41 100644 --- a/adaptive/ramp_transplant_test.go +++ b/adaptive/ramp_transplant_test.go @@ -5,7 +5,6 @@ package adaptive import ( "bufio" "context" - "crypto/tls" "io" "net" "net/http" @@ -16,8 +15,6 @@ import ( "testing" "time" - "golang.org/x/net/http2" - "github.com/goceleris/celeris/engine" "github.com/goceleris/celeris/probe" "github.com/goceleris/celeris/protocol/h2/stream" @@ -209,9 +206,9 @@ func h1Client(addr string, stop <-chan struct{}, ok, errc *atomic.Int64) { // issuing one request at a time over it until stop. Each client owns its own // Transport, so it maps to exactly one TCP connection. func h2cClient(addr string, stop <-chan struct{}, ok, errc *atomic.Int64) { - tr := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, a string, _ *tls.Config) (net.Conn, error) { + tr := &http.Transport{ + Protocols: unencryptedHTTP2Only(), + DialContext: func(ctx context.Context, network, a string) (net.Conn, error) { var d net.Dialer return d.DialContext(ctx, network, a) }, @@ -514,3 +511,12 @@ func TestRampAutoMixedAsync(t *testing.T) { t.Errorf("h2 conns broke across switches: %d errors (want 0 — non-transplantable conns must survive)", h2.errc.Load()) } } + +// unencryptedHTTP2Only makes an http.Transport speak prior-knowledge +// cleartext HTTP/2 (h2c) and nothing else, the stdlib replacement for the +// deprecated http2.Transport{AllowHTTP: true} shape. +func unencryptedHTTP2Only() *http.Protocols { + p := new(http.Protocols) + p.SetUnencryptedHTTP2(true) + return p +} diff --git a/engine/std/engine.go b/engine/std/engine.go index d5864a26..500ac705 100644 --- a/engine/std/engine.go +++ b/engine/std/engine.go @@ -17,7 +17,7 @@ import ( "github.com/goceleris/celeris/resource" "golang.org/x/net/http2" - //nolint:staticcheck // SA1019: h2c is deprecated, and its replacement + //nolint:staticcheck // SA1019: h2c (and, since x/net 0.59, http2.Server) is deprecated, and its replacement // (http.Server.Protocols + SetUnencryptedHTTP2) does NOT cover the // RFC 7540 3.2 Upgrade handshake -- net/http implements the upgrade path // internally but exposes no way for a caller to reach it. celeris#440 @@ -79,11 +79,12 @@ func New(cfg resource.Config, handler stream.Handler) (*Engine, error) { // handler, so an H2C listener still serves H1. var httpHandler http.Handler = bridge if cfg.Protocol == engine.H2C || cfg.Protocol == engine.Auto { - h2s := &http2.Server{ - MaxConcurrentStreams: cfg.MaxConcurrentStreams, - MaxReadFrameSize: cfg.MaxFrameSize, - } - httpHandler = h2c.NewHandler(bridge, h2s) //nolint:staticcheck // SA1019: see the import comment -- no stdlib equivalent covers Upgrade. + // + // x/net 0.59 deprecated http2.Server along with the handler; it is + // still the only type h2c.NewHandler accepts, so the two carry the + // same waiver. Keep the literal on one line so the waiver covers it. + h2s := &http2.Server{MaxConcurrentStreams: cfg.MaxConcurrentStreams, MaxReadFrameSize: cfg.MaxFrameSize} //nolint:staticcheck // SA1019: the type h2c.NewHandler takes; see the import comment. + httpHandler = h2c.NewHandler(bridge, h2s) //nolint:staticcheck // SA1019: see the import comment -- no stdlib equivalent covers Upgrade. } e.server = &http.Server{ diff --git a/go.mod b/go.mod index dbfc5cab..89ddcee2 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/goceleris/celeris go 1.27.0 require ( - golang.org/x/net v0.58.0 + golang.org/x/net v0.59.0 golang.org/x/sys v0.48.0 ) -require golang.org/x/text v0.41.0 // indirect +require golang.org/x/text v0.42.0 // indirect diff --git a/go.sum b/go.sum index ae115ad4..179f781b 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= diff --git a/middleware/compress/go.mod b/middleware/compress/go.mod index 49c6795c..bf2a6ec2 100644 --- a/middleware/compress/go.mod +++ b/middleware/compress/go.mod @@ -9,9 +9,9 @@ require ( ) require ( - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) // In the monorepo, build against the in-tree celeris core so submodule diff --git a/middleware/compress/go.sum b/middleware/compress/go.sum index bb8ff234..a517aa3a 100644 --- a/middleware/compress/go.sum +++ b/middleware/compress/go.sum @@ -4,9 +4,9 @@ github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= diff --git a/middleware/metrics/go.mod b/middleware/metrics/go.mod index e67678e5..2442969d 100644 --- a/middleware/metrics/go.mod +++ b/middleware/metrics/go.mod @@ -14,9 +14,9 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/prometheus/procfs v0.22.0 // indirect - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect google.golang.org/protobuf v1.36.12 // indirect ) diff --git a/middleware/metrics/go.sum b/middleware/metrics/go.sum index 84f62687..74f72cdf 100644 --- a/middleware/metrics/go.sum +++ b/middleware/metrics/go.sum @@ -22,11 +22,11 @@ go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/middleware/otel/go.mod b/middleware/otel/go.mod index 240f9558..f9eeaff1 100644 --- a/middleware/otel/go.mod +++ b/middleware/otel/go.mod @@ -17,9 +17,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) // In the monorepo, build against the in-tree celeris core so submodule diff --git a/middleware/otel/go.sum b/middleware/otel/go.sum index cdfd41b6..67135417 100644 --- a/middleware/otel/go.sum +++ b/middleware/otel/go.sum @@ -29,9 +29,9 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= diff --git a/middleware/protobuf/go.mod b/middleware/protobuf/go.mod index d2214773..a8996660 100644 --- a/middleware/protobuf/go.mod +++ b/middleware/protobuf/go.mod @@ -8,9 +8,9 @@ require ( ) require ( - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) replace github.com/goceleris/celeris => ../../ diff --git a/middleware/protobuf/go.sum b/middleware/protobuf/go.sum index d5d89f8c..2cb3c690 100644 --- a/middleware/protobuf/go.sum +++ b/middleware/protobuf/go.sum @@ -1,10 +1,10 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/middleware/sse/sse_disconnect_linux_test.go b/middleware/sse/sse_disconnect_linux_test.go index b94b246e..1b4a8aea 100644 --- a/middleware/sse/sse_disconnect_linux_test.go +++ b/middleware/sse/sse_disconnect_linux_test.go @@ -5,7 +5,6 @@ package sse_test import ( "bufio" "context" - "crypto/tls" "fmt" "io" "net" @@ -16,8 +15,6 @@ import ( "testing" "time" - "golang.org/x/net/http2" - "github.com/goceleris/celeris" celerisengine "github.com/goceleris/celeris/engine" "github.com/goceleris/celeris/middleware/sse" @@ -195,7 +192,7 @@ func openSSEStream(tb testing.TB, addr string) (net.Conn, *bufio.Reader) { // openSSEStreamH2C is openSSEStream over prior-knowledge h2c. It builds a // transport per client so every stream gets its own TCP connection (an -// http2.Transport would otherwise multiplex all 32 onto one, and killing +// an HTTP/2 transport would otherwise multiplex all 32 onto one, and killing // that conn would prove nothing about a single stream), and hands back the // raw conn the dialer produced so the caller can RST or half-close it the // same way as an H1 client. The returned closer shuts the transport's idle @@ -203,7 +200,7 @@ func openSSEStream(tb testing.TB, addr string) (net.Conn, *bufio.Reader) { // leak assertion. // // The open is bounded by a request context, NOT by a read deadline on the raw -// conn: http2.Transport keeps a persistent read loop over that socket for the +// conn: the HTTP/2 transport keeps a persistent read loop over that socket for the // life of the stream, so an absolute deadline would reset the stream from the // client side and the server would cancel the handler through handleRSTStream // — a different path from the one under test, and a false pass or a flake @@ -211,9 +208,11 @@ func openSSEStream(tb testing.TB, addr string) (net.Conn, *bufio.Reader) { func openSSEStreamH2C(tb testing.TB, addr string) (net.Conn, *bufio.Reader, func()) { tb.Helper() var raw net.Conn - tr := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, _ string, _ *tls.Config) (net.Conn, error) { + h2only := new(http.Protocols) + h2only.SetUnencryptedHTTP2(true) + tr := &http.Transport{ + Protocols: h2only, + DialContext: func(ctx context.Context, network, _ string) (net.Conn, error) { c, err := (&net.Dialer{Timeout: 2 * time.Second}).DialContext(ctx, network, addr) if err == nil { raw = c @@ -222,7 +221,7 @@ func openSSEStreamH2C(tb testing.TB, addr string) (net.Conn, *bufio.Reader, func }, } // Bound the OPEN with a request context, never with a read deadline on - // the raw conn. http2.Transport runs a persistent read loop over that + // the raw conn. The HTTP/2 transport runs a persistent read loop over that // socket for the life of the stream, so an absolute SetReadDeadline // kills the connection N seconds after dial no matter how healthy it // is -- and an SSE stream is deliberately held open far longer than diff --git a/test/benchcmp_sse/go.mod b/test/benchcmp_sse/go.mod index 693c1c58..a8b333ca 100644 --- a/test/benchcmp_sse/go.mod +++ b/test/benchcmp_sse/go.mod @@ -8,9 +8,9 @@ require ( ) require ( - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) replace github.com/goceleris/celeris => ../../ diff --git a/test/benchcmp_sse/go.sum b/test/benchcmp_sse/go.sum index 5b9b43a5..3137082f 100644 --- a/test/benchcmp_sse/go.sum +++ b/test/benchcmp_sse/go.sum @@ -1,8 +1,8 @@ github.com/tmaxmax/go-sse v0.11.0 h1:nogmJM6rJUoOLoAwEKeQe5XlVpt9l7N82SS1jI7lWFg= github.com/tmaxmax/go-sse v0.11.0/go.mod h1:u/2kZQR1tyngo1lKaNCj1mJmhXGZWS1Zs5yiSOD+Eg8= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= diff --git a/test/benchcmp_ws/go.mod b/test/benchcmp_ws/go.mod index 07dfc35a..2db79ddc 100644 --- a/test/benchcmp_ws/go.mod +++ b/test/benchcmp_ws/go.mod @@ -8,9 +8,9 @@ require ( ) require ( - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) replace github.com/goceleris/celeris => ../../ diff --git a/test/benchcmp_ws/go.sum b/test/benchcmp_ws/go.sum index 0a7589b4..3d5bd3d7 100644 --- a/test/benchcmp_ws/go.sum +++ b/test/benchcmp_ws/go.sum @@ -1,8 +1,8 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= diff --git a/test/conformance/h2c_test.go b/test/conformance/h2c_test.go index 16bb5b1a..902f5504 100644 --- a/test/conformance/h2c_test.go +++ b/test/conformance/h2c_test.go @@ -1,16 +1,11 @@ package conformance import ( - "context" - "crypto/tls" - "net" "net/http" "testing" "time" "github.com/goceleris/celeris/engine" - - "golang.org/x/net/http2" ) func TestH2CLifecycle(t *testing.T) { @@ -23,13 +18,7 @@ func TestH2CLifecycle(t *testing.T) { addr, cleanup := startEngine(t, ef, engine.H2C) defer cleanup() - transport := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, addr) - }, - } + transport := &http.Transport{Protocols: h2cOnly()} client := &http.Client{ Transport: transport, diff --git a/test/conformance/helper_test.go b/test/conformance/helper_test.go index fdbfb6c1..f8d11429 100644 --- a/test/conformance/helper_test.go +++ b/test/conformance/helper_test.go @@ -2,7 +2,6 @@ package conformance import ( "context" - "crypto/tls" "fmt" "io" "net" @@ -13,8 +12,6 @@ import ( "github.com/goceleris/celeris/engine" "github.com/goceleris/celeris/protocol/h2/stream" "github.com/goceleris/celeris/resource" - - "golang.org/x/net/http2" ) // testHandler is a simple echo handler for conformance testing. @@ -140,12 +137,8 @@ func clientForProto(proto engine.Protocol) *http.Client { if proto == engine.H2C { return &http.Client{ Timeout: 5 * time.Second, - Transport: &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, addr) - }, + Transport: &http.Transport{ + Protocols: h2cOnly(), }, } } @@ -185,3 +178,12 @@ func sendRequestProto(t *testing.T, addr, method, path string, body io.Reader, p } return resp } + +// h2cOnly makes an http.Transport speak prior-knowledge cleartext HTTP/2 +// and nothing else: the stdlib replacement for the deprecated +// http2.Transport{AllowHTTP: true} shape. +func h2cOnly() *http.Protocols { + p := new(http.Protocols) + p.SetUnencryptedHTTP2(true) + return p +} diff --git a/test/drivercmp/postgres/go.mod b/test/drivercmp/postgres/go.mod index f44697ea..329582c6 100644 --- a/test/drivercmp/postgres/go.mod +++ b/test/drivercmp/postgres/go.mod @@ -4,7 +4,7 @@ go 1.27.0 require ( github.com/goceleris/celeris v0.0.0 - github.com/jackc/pgx/v5 v5.10.0 + github.com/jackc/pgx/v5 v5.11.0 github.com/lib/pq v1.12.3 ) @@ -12,10 +12,10 @@ require ( github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect - golang.org/x/net v0.58.0 // indirect - golang.org/x/sync v0.22.0 // indirect + golang.org/x/net v0.59.0 // indirect + golang.org/x/sync v0.23.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) replace github.com/goceleris/celeris => ../../.. diff --git a/test/drivercmp/postgres/go.sum b/test/drivercmp/postgres/go.sum index 2f9f4c80..f8dec7f7 100644 --- a/test/drivercmp/postgres/go.sum +++ b/test/drivercmp/postgres/go.sum @@ -5,8 +5,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.10.0 h1:VhSvgU2jSli8o3AqIEOTJr7rZwAEUVo4E4XhR94Zfr0= -github.com/jackc/pgx/v5 v5.10.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg= +github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= @@ -18,14 +18,14 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= -golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= -golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/test/drivercmp/redis/go.mod b/test/drivercmp/redis/go.mod index 3758b8c0..a881715d 100644 --- a/test/drivercmp/redis/go.mod +++ b/test/drivercmp/redis/go.mod @@ -10,9 +10,9 @@ require ( require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/net v0.58.0 // indirect + golang.org/x/net v0.59.0 // indirect golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.41.0 // indirect + golang.org/x/text v0.42.0 // indirect ) replace github.com/goceleris/celeris => ../../.. diff --git a/test/drivercmp/redis/go.sum b/test/drivercmp/redis/go.sum index ed664d62..dd910b33 100644 --- a/test/drivercmp/redis/go.sum +++ b/test/drivercmp/redis/go.sum @@ -18,9 +18,9 @@ github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= diff --git a/test/integration/adaptive_hybrid_test.go b/test/integration/adaptive_hybrid_test.go index 7ff16be8..b6de31fc 100644 --- a/test/integration/adaptive_hybrid_test.go +++ b/test/integration/adaptive_hybrid_test.go @@ -4,7 +4,6 @@ package integration import ( "context" - "crypto/tls" "fmt" "io" "net" @@ -16,8 +15,6 @@ import ( "github.com/goceleris/celeris/adaptive" "github.com/goceleris/celeris/engine" "github.com/goceleris/celeris/engine/epoll" - - "golang.org/x/net/http2" ) func TestAdaptiveAutoProtocol(t *testing.T) { @@ -415,11 +412,20 @@ func TestEpollPauseResume(t *testing.T) { func h2cClient(addr string) *http.Client { return &http.Client{ Timeout: 3 * time.Second, - Transport: &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, _ string, _ *tls.Config) (net.Conn, error) { + Transport: &http.Transport{ + Protocols: h2cOnly(), + DialContext: func(ctx context.Context, network, _ string) (net.Conn, error) { return (&net.Dialer{}).DialContext(ctx, network, addr) }, }, } } + +// h2cOnly makes an http.Transport speak prior-knowledge cleartext HTTP/2 +// and nothing else: the stdlib replacement for the deprecated +// http2.Transport{AllowHTTP: true} shape. +func h2cOnly() *http.Protocols { + p := new(http.Protocols) + p.SetUnencryptedHTTP2(true) + return p +} diff --git a/test/spec/helpers_test.go b/test/spec/helpers_test.go index b06e85ec..c1eddb2b 100644 --- a/test/spec/helpers_test.go +++ b/test/spec/helpers_test.go @@ -4,7 +4,6 @@ package spec import ( "bufio" "context" - "crypto/tls" "fmt" "net" "net/http" @@ -16,8 +15,6 @@ import ( stdengine "github.com/goceleris/celeris/engine/std" "github.com/goceleris/celeris/protocol/h2/stream" "github.com/goceleris/celeris/resource" - - "golang.org/x/net/http2" ) type specEngine struct { @@ -156,12 +153,8 @@ func startSpecEngineWithConfig(t *testing.T, se specEngine, customize func(*reso func probeEngine(addr string, proto engine.Protocol) error { client := &http.Client{Timeout: 2 * time.Second} if proto == engine.H2C { - client.Transport = &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, a string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, a) - }, + client.Transport = &http.Transport{ + Protocols: h2cOnly(), } } resp, err := client.Get("http://" + addr + "/healthz") @@ -272,3 +265,12 @@ func rawSendRecv(t *testing.T, addr, request string) *http.Response { } return resp } + +// h2cOnly makes an http.Transport speak prior-knowledge cleartext HTTP/2 +// and nothing else: the stdlib replacement for the deprecated +// http2.Transport{AllowHTTP: true} shape. +func h2cOnly() *http.Protocols { + p := new(http.Protocols) + p.SetUnencryptedHTTP2(true) + return p +} diff --git a/test/spec/integration_test.go b/test/spec/integration_test.go index 0619e335..1f61337d 100644 --- a/test/spec/integration_test.go +++ b/test/spec/integration_test.go @@ -1,11 +1,8 @@ package spec import ( - "context" - "crypto/tls" "fmt" "io" - "net" "net/http" "strings" "sync" @@ -13,8 +10,6 @@ import ( "time" "github.com/goceleris/celeris/engine" - - "golang.org/x/net/http2" ) // TestHTTP1Parallel sends concurrent HTTP/1.1 requests to each engine. @@ -70,12 +65,8 @@ func TestH2CParallel(t *testing.T) { for _, se := range specEngines { t.Run(se.name, func(t *testing.T) { addr := startSpecEngine(t, se, engine.H2C) - transport := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, a string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, a) - }, + transport := &http.Transport{ + Protocols: h2cOnly(), } client := &http.Client{ Timeout: 10 * time.Second, @@ -145,12 +136,8 @@ func TestAutoProtocolDetection(t *testing.T) { }) t.Run("H2C", func(t *testing.T) { - transport := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, a string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, a) - }, + transport := &http.Transport{ + Protocols: h2cOnly(), } client := &http.Client{Timeout: 5 * time.Second, Transport: transport} resp, err := client.Get("http://" + addr + "/auto-h2c") @@ -175,12 +162,8 @@ func TestAutoProtocolDetection(t *testing.T) { Timeout: 5 * time.Second, Transport: &http.Transport{MaxConnsPerHost: 20}, } - h2Transport := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, a string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, a) - }, + h2Transport := &http.Transport{ + Protocols: h2cOnly(), } h2Client := &http.Client{Timeout: 5 * time.Second, Transport: h2Transport} @@ -234,12 +217,8 @@ func TestH2CMultipleStreams(t *testing.T) { for _, se := range specEngines { t.Run(se.name, func(t *testing.T) { addr := startSpecEngine(t, se, engine.H2C) - transport := &http2.Transport{ - AllowHTTP: true, - DialTLSContext: func(ctx context.Context, network, a string, _ *tls.Config) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, a) - }, + transport := &http.Transport{ + Protocols: h2cOnly(), } client := &http.Client{Timeout: 10 * time.Second, Transport: transport}