From: Neal Patel Date: Tue, 1 Apr 2025 21:04:29 +0000 (-0400) Subject: net/http: push roundTrip panic higher in the stack X-Git-Tag: go1.25rc1~514 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=53badd4836f88c45e686c60712ac3c9d6364e505;p=gostls13.git net/http: push roundTrip panic higher in the stack If Transport is a non-nil interface pointing to a nil implementer, then a panic inside of roundTrip further obsfucates the issue. Change-Id: I47664b8e6185c5f56b5e529f49022484b5ea1d94 Reviewed-on: https://go-review.googlesource.com/c/go/+/661897 LUCI-TryBot-Result: Go LUCI Auto-Submit: Neal Patel Reviewed-by: Damien Neil --- diff --git a/src/net/http/roundtrip.go b/src/net/http/roundtrip.go index 6674b8419f..d2e29a33d9 100644 --- a/src/net/http/roundtrip.go +++ b/src/net/http/roundtrip.go @@ -27,5 +27,8 @@ func badRoundTrip(*Transport, *Request) (*Response, error) // Like the RoundTripper interface, the error types returned // by RoundTrip are unspecified. func (t *Transport) RoundTrip(req *Request) (*Response, error) { + if t == nil { + panic("transport is nil") + } return t.roundTrip(req) }