diff --git a/listener/inbound/common_test.go b/listener/inbound/common_test.go index a6adb1a1..b1be5e4d 100644 --- a/listener/inbound/common_test.go +++ b/listener/inbound/common_test.go @@ -155,9 +155,9 @@ func NewHttpTestTunnel() *TestTunnel { io.Copy(io.Discard, r.Body) render.Data(w, r, httpData[:size]) }) - h2Server := &http.Http2Server{} + //h2Server := &http.Http2Server{} server := http.Server{Handler: r} - _ = http.Http2ConfigureServer(&server, h2Server) + //_ = http.Http2ConfigureServer(&server, h2Server) go server.Serve(ln) testFn := func(t *testing.T, proxy C.ProxyAdapter, proto string, size int) { req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s://%s%s?size=%d", proto, remoteAddr, httpPath, size), bytes.NewReader(httpData[:size])) @@ -214,6 +214,9 @@ func NewHttpTestTunnel() *TestTunnel { defer resp.Body.Close() assert.Equal(t, http.StatusOK, resp.StatusCode) + if proto == "https" { // ensure server using http2 + assert.Equal(t, 2, resp.ProtoMajor) + } data, err := io.ReadAll(resp.Body) if !assert.NoError(t, err) { @@ -282,11 +285,12 @@ func NewHttpTestTunnel() *TestTunnel { if err := tlsConn.HandshakeContext(ctx); err != nil { return } - if tlsConn.ConnectionState().NegotiatedProtocol == http.Http2NextProtoTLS { - h2Server.ServeConn(tlsConn, &http.Http2ServeConnOpts{BaseConfig: &server}) - } else { - ln.ch <- tlsConn - } + //if tlsConn.ConnectionState().NegotiatedProtocol == http.Http2NextProtoTLS { + // h2Server.ServeConn(tlsConn, &http.Http2ServeConnOpts{BaseConfig: &server}) + //} else { + // ln.ch <- tlsConn + //} + ln.ch <- tlsConn } else { ln.ch <- c }