diff options
Diffstat (limited to 'src/net/http')
| -rw-r--r-- | src/net/http/serve_test.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index b2cf43cd3f..f2ba8705d1 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -18,7 +18,6 @@ import ( "encoding/json" "errors" "fmt" - "internal/synctest" "internal/testenv" "io" "log" @@ -44,6 +43,7 @@ import ( "sync/atomic" "syscall" "testing" + "testing/synctest" "time" ) @@ -7648,3 +7648,17 @@ func testServerTLSNextProtos(t *testing.T, mode testMode) { t.Fatalf("after running test: original NextProtos slice = %v, want %v", nextProtos, wantNextProtos) } } + +// Verifies that starting a server with HTTP/2 disabled and an empty TLSConfig does not panic. +// (Tests fix in CL 758560.) +func TestServerHTTP2Disabled(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + li := fakeNetListen() + srv := &Server{} + srv.Protocols = new(Protocols) + srv.Protocols.SetHTTP1(true) + go srv.ServeTLS(li, "", "") + synctest.Wait() + srv.Shutdown(t.Context()) + }) +} |
