BUG/MINOR: mux-h2: make sure request trailers on aborted streams don't break the connection

We used to respond a connection error in case we received a trailers
frame on a closed stream, but it's a problem to do this if the error
was caused by a reset because the sender has not yet received it and
is just a victim of the timing. Thus we must not close the connection
in this case.

This patch may be backported to 1.9 but then it requires the following
previous ones :
   MINOR: h2: add a generic frame checker
   MEDIUM: mux-h2: check the frame validity before considering the stream state
   CLEANUP: mux-h2: remove stream ID and frame length checks from the frame parsers
This commit is contained in:
Willy Tarreau 2019-01-30 11:44:07 +01:00
parent b860c73756
commit 1f035507af

View File

@ -1854,9 +1854,12 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s)
goto out; goto out;
goto done; goto done;
} }
error = H2_ERR_PROTOCOL_ERROR; /* the connection was already killed by an RST, let's consume
sess_log(h2c->conn->owner); * the data and send another RST.
goto conn_err; */
error = h2c_decode_headers(h2c, &rxbuf, &flags, &body_len);
h2s = (struct h2s*)h2_error_stream;
goto send_rst;
} }
else if (h2c->dsi <= h2c->max_id || !(h2c->dsi & 1)) { else if (h2c->dsi <= h2c->max_id || !(h2c->dsi & 1)) {
/* RFC7540#5.1.1 stream id > prev ones, and must be odd here */ /* RFC7540#5.1.1 stream id > prev ones, and must be odd here */