BUG/MEDIUM: h2: don't switch the state to HREM before end of DATA frame

We used to switch the stream's state to HREM when seeing and ES bit on
the DATA frame before actually being able to process that frame, possibly
resulting in the DATA frame being processed after the stream was seen as
half-closed and possibly being rejected. The state must not change before
the frame is really processed.

Also fixes a harmless typo in the flag name which should have DATA and
not HEADERS in its name (but all values are equal).

Must be backported to 1.8.
This commit is contained in:
Willy Tarreau 2017-12-11 18:45:08 +01:00
parent 6847262211
commit c4134ba8b0

View File

@ -1656,12 +1656,6 @@ static int h2c_frt_handle_data(struct h2c *h2c, struct h2s *h2s)
goto strm_err;
}
/* last frame */
if (h2c->dff & H2_F_HEADERS_END_STREAM) {
h2s->st = H2_SS_HREM;
h2s->flags |= H2_SF_ES_RCVD;
}
/* call the upper layers to process the frame, then let the upper layer
* notify the stream about any change.
*/
@ -1692,6 +1686,13 @@ static int h2c_frt_handle_data(struct h2c *h2c, struct h2s *h2s)
if (h2c->st0 == H2_CS_FRAME_P)
return 0;
/* last frame */
if (h2c->dff & H2_F_DATA_END_STREAM) {
h2s->st = H2_SS_HREM;
h2s->flags |= H2_SF_ES_RCVD;
}
return 1;
conn_err: