http2/h2i: dump PUSH_PROMISE headers in h2i

Change-Id: Id891991e2b8371ad5744e7a0ec392d9d9bbeefdc
Reviewed-on: https://go-review.googlesource.com/50130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/http2/h2i/h2i.go b/http2/h2i/h2i.go
index 76c7787..3f4cfe2 100644
--- a/http2/h2i/h2i.go
+++ b/http2/h2i/h2i.go
@@ -460,6 +460,15 @@
 				app.hdec = hpack.NewDecoder(tableSize, app.onNewHeaderField)
 			}
 			app.hdec.Write(f.HeaderBlockFragment())
+		case *http2.PushPromiseFrame:
+			if app.hdec == nil {
+				// TODO: if the user uses h2i to send a SETTINGS frame advertising
+				// something larger, we'll need to respect SETTINGS_HEADER_TABLE_SIZE
+				// and stuff here instead of using the 4k default. But for now:
+				tableSize := uint32(4 << 10)
+				app.hdec = hpack.NewDecoder(tableSize, app.onNewHeaderField)
+			}
+			app.hdec.Write(f.HeaderBlockFragment())
 		}
 	}
 }