mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: h2: centralize the check for the idle streams
RFC7540#5.1 is pretty clear : "any frame other than HEADERS or PRIORITY in this state MUST be treated as a connection error". Instead of dealing with this for each and every frame type, let's do it once for all in the main demux loop.
This commit is contained in:
parent
e96b0922e9
commit
f65b80dd47
19
src/mux_h2.c
19
src/mux_h2.c
@ -1216,10 +1216,6 @@ static int h2c_handle_window_update(struct h2c *h2c, struct h2s *h2s)
|
|||||||
|
|
||||||
if (h2c->dsi != 0) {
|
if (h2c->dsi != 0) {
|
||||||
/* stream window update */
|
/* stream window update */
|
||||||
if (h2s->st == H2_SS_IDLE) {
|
|
||||||
error = H2_ERR_PROTOCOL_ERROR;
|
|
||||||
goto conn_err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* it's not an error to receive WU on a closed stream */
|
/* it's not an error to receive WU on a closed stream */
|
||||||
if (h2s->st == H2_SS_CLOSED)
|
if (h2s->st == H2_SS_CLOSED)
|
||||||
@ -1325,11 +1321,6 @@ static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s)
|
|||||||
goto conn_err;
|
goto conn_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h2s->st == H2_SS_IDLE) {
|
|
||||||
error = H2_ERR_PROTOCOL_ERROR;
|
|
||||||
goto conn_err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h2c->dfl != 4) {
|
if (h2c->dfl != 4) {
|
||||||
error = H2_ERR_FRAME_SIZE_ERROR;
|
error = H2_ERR_FRAME_SIZE_ERROR;
|
||||||
goto conn_err;
|
goto conn_err;
|
||||||
@ -1612,6 +1603,16 @@ static void h2_process_demux(struct h2c *h2c)
|
|||||||
/* Only H2_CS_FRAME_P and H2_CS_FRAME_A here */
|
/* Only H2_CS_FRAME_P and H2_CS_FRAME_A here */
|
||||||
h2s = h2c_st_by_id(h2c, h2c->dsi);
|
h2s = h2c_st_by_id(h2c, h2c->dsi);
|
||||||
|
|
||||||
|
if (h2s->st == H2_SS_IDLE &&
|
||||||
|
h2c->dft != H2_FT_HEADERS && h2c->dft != H2_FT_PRIORITY) {
|
||||||
|
/* RFC7540#5.1: any frame other than HEADERS or PRIORITY in
|
||||||
|
* this state MUST be treated as a connection error
|
||||||
|
*/
|
||||||
|
h2c_error(h2c, H2_ERR_PROTOCOL_ERROR);
|
||||||
|
h2c->st0 = H2_CS_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (h2c->dft) {
|
switch (h2c->dft) {
|
||||||
case H2_FT_SETTINGS:
|
case H2_FT_SETTINGS:
|
||||||
if (h2c->st0 == H2_CS_FRAME_P)
|
if (h2c->st0 == H2_CS_FRAME_P)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user