mirror of
https://github.com/golang/net.git
synced 2026-04-01 02:47:08 +09:00
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:
committed by
Brad Fitzpatrick
parent
351d144fa1
commit
6105869963
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user