tailscale/control/controlhttp
Achille Roussel 7f3bbc9865 net/netutil: add NewDefaultTransport to avoid http.DefaultTransport panics
Several packages built their HTTP transports with

    http.DefaultTransport.(*http.Transport).Clone()

The standard library only documents http.DefaultTransport as an
http.RoundTripper, so an application is free to replace it with a
RoundTripper that is not a *http.Transport (e.g. an instrumented or
tracing wrapper). When such an application embeds tsnet.Server, the
unchecked type assertion panics as soon as tsnet brings up its control
connection, DNS bootstrap, or log uploader.

Add netutil.NewDefaultTransport, which returns a clone of the global
when it is still the standard *http.Transport (preserving existing
behavior) and otherwise returns a fresh transport mirroring the stdlib
defaults. Route every clone site through it.

Updates #19937

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2026-06-01 12:28:36 -07:00
..
controlhttpcommon all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
controlhttpserver all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
client_common.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
client_js.go control/controlhttp: use ws:// when HTTPSPort is NoPort in JS dialer 2026-05-06 15:58:58 -07:00
client.go net/netutil: add NewDefaultTransport to avoid http.DefaultTransport panics 2026-06-01 12:28:36 -07:00
constants.go tsd, all: add Sys.ExtraRootCAs, plumb through TLS dial paths 2026-04-07 18:10:54 -07:00
http_test.go all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00