MINOR: h2: centralize the check for the half-closed(remote) streams
RFC7540#5.1 is pretty clear : "any frame other than WINDOW_UPDATE,
PRIORITY, or RST_STREAM in this state MUST be treated as a connection
error of type STREAM_CLOSED". Instead of dealing with this for each
and every frame type, let's do it once for all in the main demux loop.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 5281952..2f7d4d7 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1613,6 +1613,15 @@
break;
}
+ if (h2s->st == H2_SS_HREM && h2c->dft != H2_FT_WINDOW_UPDATE &&
+ h2c->dft != H2_FT_RST_STREAM && h2c->dft != H2_FT_PRIORITY) {
+ /* RFC7540#5.1: any frame other than WU/PRIO/RST in
+ * this state MUST be treated as a stream error
+ */
+ h2s_error(h2s, H2_ERR_STREAM_CLOSED);
+ goto strm_err;
+ }
+
switch (h2c->dft) {
case H2_FT_SETTINGS:
if (h2c->st0 == H2_CS_FRAME_P)
@@ -1679,6 +1688,7 @@
ret = h2c->dfl == 0;
}
+ strm_err:
/* RST are sent similarly to frame acks */
if (h2s->st == H2_SS_ERROR) {
if (h2c->st0 == H2_CS_FRAME_P)