BUG/MINOR: mux-h2: make sure response HEADERS are not received in other states than OPEN and HLOC

RFC7540#5.1 states that these are the only states allowing any frame
type. For response HEADERS frames, we cannot accept that they are
delivered on idle streams of course, so we're left with these two
states only. It is important to test this so that we can remove the
generic CLOSE_STREAM test for such frames in the main loop.

This must be backported to 1.9 (1.8 doesn't have response HEADERS).
This commit is contained in:
Willy Tarreau 2019-01-30 16:55:48 +01:00
parent 8d9ac3ed8b
commit 08bb1d6109

View File

@ -2039,6 +2039,13 @@ static struct h2s *h2c_bck_handle_headers(struct h2c *h2c, struct h2s *h2s)
if (h2c->st0 >= H2_CS_ERROR) if (h2c->st0 >= H2_CS_ERROR)
return NULL; return NULL;
if (h2s->st != H2_SS_OPEN && h2s->st != H2_SS_HLOC) {
/* RFC7540#5.1 */
h2s_error(h2s, H2_ERR_STREAM_CLOSED);
h2c->st0 = H2_CS_FRAME_E;
return NULL;
}
if (error <= 0) { if (error <= 0) {
if (error == 0) if (error == 0)
return NULL; // missing data return NULL; // missing data