http2/h2c: Add missing error check

Before this change, error returned by `io.ReadFull` was silently
ignored

Signed-off-by: Michal Rostecki <mrostecki@suse.de>
Change-Id: I6a4604f0c0172a4b951fa4fc99ee83c6ba2ac8d7
Reviewed-on: https://go-review.googlesource.com/c/153137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Michal Rostecki
2018-12-07 15:56:26 +01:00
committed by Brad Fitzpatrick
parent 351d144fa1
commit 6105869963

View File

@@ -118,6 +118,9 @@ func initH2CWithPriorKnowledge(w http.ResponseWriter) (net.Conn, error) {
buf := make([]byte, len(expectedBody))
n, err := io.ReadFull(rw, buf)
if err != nil {
return nil, fmt.Errorf("could not read from the buffer: %s", err)
}
if string(buf[:n]) == expectedBody {
c := &rwConn{