src/net/http/h2_bundle.go | 8 ++++++++ diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 83f1671a5d08d6a4664494de5b7b34cd73f14c2b..2c78b2270ceb862d06f1fd76f52bf6f40787f853 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -8222,6 +8222,14 @@ } return nil } if f.Length > 0 { + if cs.req.Method == "HEAD" && len(data) > 0 { + cc.logf("protocol error: received DATA on a HEAD request") + rl.endStreamError(cs, http2StreamError{ + StreamID: f.StreamID, + Code: http2ErrCodeProtocol, + }) + return nil + } // Check connection-level flow control. cc.mu.Lock() if cs.inflow.available() >= int32(f.Length) {