Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions adaptive/ramp_transplant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package adaptive
import (
"bufio"
"context"
"crypto/tls"
"io"
"net"
"net/http"
Expand All @@ -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"
Expand Down Expand Up @@ -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)
},
Expand Down Expand Up @@ -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
}
13 changes: 7 additions & 6 deletions engine/std/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
4 changes: 2 additions & 2 deletions middleware/compress/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions middleware/compress/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
4 changes: 2 additions & 2 deletions middleware/metrics/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
8 changes: 4 additions & 4 deletions middleware/metrics/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
4 changes: 2 additions & 2 deletions middleware/otel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions middleware/otel/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
4 changes: 2 additions & 2 deletions middleware/protobuf/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ../../
8 changes: 4 additions & 4 deletions middleware/protobuf/go.sum
Original file line number Diff line number Diff line change
@@ -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=
17 changes: 8 additions & 9 deletions middleware/sse/sse_disconnect_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package sse_test
import (
"bufio"
"context"
"crypto/tls"
"fmt"
"io"
"net"
Expand All @@ -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"
Expand Down Expand Up @@ -195,25 +192,27 @@ 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
// connections down so its read/write goroutines do not count against the
// 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
// depending on timing.
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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/benchcmp_sse/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ../../
8 changes: 4 additions & 4 deletions test/benchcmp_sse/go.sum
Original file line number Diff line number Diff line change
@@ -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=
4 changes: 2 additions & 2 deletions test/benchcmp_ws/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ../../
8 changes: 4 additions & 4 deletions test/benchcmp_ws/go.sum
Original file line number Diff line number Diff line change
@@ -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=
13 changes: 1 addition & 12 deletions test/conformance/h2c_test.go
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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,
Expand Down
20 changes: 11 additions & 9 deletions test/conformance/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package conformance

import (
"context"
"crypto/tls"
"fmt"
"io"
"net"
Expand All @@ -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.
Expand Down Expand Up @@ -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(),
},
}
}
Expand Down Expand Up @@ -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
}
Loading