http2: use custom concurrent safe noBodyReader type when no body is present

Previously it used to use an empty bytes.Reader. However bytes.Reader is
concurrent safe when empty only on Read, that an issue now that io.NopCloser
forwards WriteTo.

Change-Id: Icdbd63876394b66ae8f3c8d410dc81a9b8dff33b
Reviewed-on: https://go-review.googlesource.com/c/net/+/401014
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
diff --git a/http2/transport.go b/http2/transport.go
index 9180ba3..4ded4df 100644
--- a/http2/transport.go
+++ b/http2/transport.go
@@ -16,7 +16,6 @@
 	"errors"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"log"
 	"math"
 	mathrand "math/rand"
@@ -2904,7 +2903,12 @@
 	log.Printf(format, args...)
 }
 
-var noBody io.ReadCloser = ioutil.NopCloser(bytes.NewReader(nil))
+var noBody io.ReadCloser = noBodyReader{}
+
+type noBodyReader struct{}
+
+func (noBodyReader) Close() error             { return nil }
+func (noBodyReader) Read([]byte) (int, error) { return 0, io.EOF }
 
 type missingBody struct{}