net/http/internal/http2: remove TestServerUpgradeRequestPrefaceFailure

This test exercises the h2c upgrade path, where a client sends
an HTTP/1 requests and receives an HTTP/2 response.
We don't support this path any more, so drop the test.

For #67810

Change-Id: Ib100c3afb18a98f613c19023cb2d5a026a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/751308
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Damien Neil
2026-03-03 15:39:59 -08:00
committed by Gopher Robot
parent d6d0f5e08d
commit 9d3210150b

View File

@@ -4705,29 +4705,6 @@ func testServerContinuationAfterInvalidHeader(t testing.TB) {
}
}
func TestServerUpgradeRequestPrefaceFailure(t *testing.T) {
synctestTest(t, testServerUpgradeRequestPrefaceFailure)
}
func testServerUpgradeRequestPrefaceFailure(t testing.TB) {
// An h2c upgrade request fails when the client preface is not as expected.
s2 := &Server{
// Setting IdleTimeout triggers #67168.
IdleTimeout: 60 * time.Minute,
}
c1, c2 := net.Pipe()
donec := make(chan struct{})
go func() {
defer close(donec)
s2.ServeConn(c1, &ServeConnOpts{
UpgradeRequest: httptest.NewRequest("GET", "/", nil),
})
}()
// The server expects to see the HTTP/2 preface,
// but we close the connection instead.
c2.Close()
<-donec
}
// Issue 67036: A stream error should result in the handler's request context being canceled.
func TestServerRequestCancelOnError(t *testing.T) { synctestTest(t, testServerRequestCancelOnError) }
func testServerRequestCancelOnError(t testing.TB) {