http2: set Response.ContentLength to 0 when headers end stream

When reading a response with no Content-Length and no body, set the
Response ContentLength to 0.

Fixes failing net/http TestH2_204NoBody and TestH2_304_NoBody tests.

Change-Id: I8ded6f8febfce62e00f2c37de65cbb09b306f7c6
Reviewed-on: https://go-review.googlesource.com/c/net/+/359834
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/http2/transport.go b/http2/transport.go
index 7f376af..d9c528e 100644
--- a/http2/transport.go
+++ b/http2/transport.go
@@ -2291,6 +2291,8 @@
 	} else if len(clens) > 1 {
 		// TODO: care? unlike http/1, it won't mess up our framing, so it's
 		// more safe smuggling-wise to ignore.
+	} else if f.StreamEnded() {
+		res.ContentLength = 0
 	}
 
 	if cs.isHead {