http2: add Transport strictness, paranoia, logging for unwanted DATA frames
I can't reproduce the user's bug yet, but this might fix or at least
help clarify what's happening.
Also deflakes a test.
Updates golang/go#13932
Change-Id: If56bdd833f183d4502701e65e56749434bd82150
Reviewed-on: https://go-review.googlesource.com/18576
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/http2/transport_test.go b/http2/transport_test.go
index 4a42f66..cd6f3df 100644
--- a/http2/transport_test.go
+++ b/http2/transport_test.go
@@ -1230,16 +1230,17 @@
}
}
ct.run()
-
}
// Test that the the Transport returns a typed error from Response.Body.Read calls
// when the server sends an error. (here we use a panic, since that should generate
// a stream error, but others like cancel should be similar)
func TestTransportBodyReadErrorType(t *testing.T) {
+ doPanic := make(chan bool, 1)
st := newServerTester(t,
func(w http.ResponseWriter, r *http.Request) {
w.(http.Flusher).Flush() // force headers out
+ <-doPanic
panic("boom")
},
optOnlyServer,
@@ -1256,6 +1257,7 @@
t.Fatal(err)
}
defer res.Body.Close()
+ doPanic <- true
buf := make([]byte, 100)
n, err := res.Body.Read(buf)
want := StreamError{StreamID: 0x1, Code: 0x2}