From 080aa8e9647e5211650f34f3a93fb493afbe396d Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 3 Mar 2026 08:12:25 -0800 Subject: net/http: use net/http/internal/http2 rather than h2_bundle.go Rework net/http/internal/http2 to use internally-defined types rather than net/http types (to avoid an import cycle). Remove h2_bundle.go, and replace it with calls into net/http/internal/http2 instead. For #67810 Change-Id: I56a1b28dbd0e302ab15a30f819dd46256a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751304 Reviewed-by: Nicholas Husin LUCI-TryBot-Result: Go LUCI Auto-Submit: Damien Neil Reviewed-by: Nicholas Husin --- src/net/http/export_test.go | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'src/net/http/export_test.go') diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 472d9c37ae..b499769c4f 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -29,7 +29,6 @@ var ( ExportErrServerClosedIdle = errServerClosedIdle ExportServeFile = serveFile ExportScanETag = scanETag - ExportHttp2ConfigureServer = http2ConfigureServer Export_shouldCopyHeaderOnRedirect = shouldCopyHeaderOnRedirect Export_writeStatusLine = writeStatusLine Export_is408Message = is408Message @@ -135,29 +134,15 @@ func (t *Transport) IdleConnStrsForTesting() []string { defer t.idleMu.Unlock() for _, conns := range t.idleConn { for _, pc := range conns { + if pc.conn == nil { + continue + } ret = append(ret, pc.conn.LocalAddr().String()+"/"+pc.conn.RemoteAddr().String()) } } - slices.Sort(ret) - return ret -} - -func (t *Transport) IdleConnStrsForTesting_h2() []string { - var ret []string - noDialPool := t.h2transport.(*http2Transport).ConnPool.(http2noDialClientConnPool) - pool := noDialPool.http2clientConnPool - - pool.mu.Lock() - defer pool.mu.Unlock() - - for k, ccs := range pool.conns { - for _, cc := range ccs { - if cc.idleState().canTakeNewRequest { - ret = append(ret, k) - } - } + if f, ok := t.h2transport.(interface{ IdleConnStrsForTesting() []string }); ok { + ret = append(ret, f.IdleConnStrsForTesting()...) } - slices.Sort(ret) return ret } @@ -256,15 +241,6 @@ func hookSetter(dst *func()) func(func()) { } } -func ExportHttp2ConfigureTransport(t *Transport) error { - t2, err := http2configureTransports(t) - if err != nil { - return err - } - t.h2transport = t2 - return nil -} - func (s *Server) ExportAllConnsIdle() bool { s.mu.Lock() defer s.mu.Unlock() -- cgit v1.3