]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: push roundTrip panic higher in the stack
authorNeal Patel <nealpatel@google.com>
Tue, 1 Apr 2025 21:04:29 +0000 (17:04 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 8 Apr 2025 21:27:47 +0000 (14:27 -0700)
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Neal Patel <nealpatel@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/roundtrip.go

index 6674b8419f3d32327e7e09fffad953481a1bda06..d2e29a33d990dba8cf82245c2f041d6a108c395e 100644 (file)
@@ -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)
 }