BUG/MINOR: mux-h2: make empty HEADERS frame return a connection error

We were returning a stream error of type PROTOCOL_ERROR on empty HEADERS
frames, but RFC7540#4.2 stipulates that we should instead return a
connection error of type FRAME_SIZE_ERROR.

This may be backported to 1.9 and 1.8 though it's unlikely to have any
real life effect.
This commit is contained in:
Willy Tarreau 2018-12-23 08:13:59 +01:00
parent 9832a37b16
commit c4ea04c2b6

View File

@ -1824,9 +1824,10 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s)
int error;
if (!h2c->dfl) {
error = H2_ERR_PROTOCOL_ERROR; // empty headers frame!
/* RFC7540#4.2 */
error = H2_ERR_FRAME_SIZE_ERROR; // empty headers frame!
sess_log(h2c->conn->owner);
goto strm_err;
goto conn_err;
}
if (!b_size(&h2c->dbuf))
@ -1914,9 +1915,10 @@ static struct h2s *h2c_bck_handle_headers(struct h2c *h2c, struct h2s *h2s)
int error;
if (!h2c->dfl) {
error = H2_ERR_PROTOCOL_ERROR; // empty headers frame!
/* RFC7540#4.2 */
error = H2_ERR_FRAME_SIZE_ERROR; // empty headers frame!
sess_log(h2c->conn->owner);
goto strm_err;
goto conn_err;
}
if (!b_size(&h2c->dbuf))
@ -3103,9 +3105,9 @@ static int h2s_decode_headers(struct h2s *h2s)
int try = 0;
if (!h2c->dfl) {
h2s_error(h2s, H2_ERR_PROTOCOL_ERROR); // empty headers frame!
h2c->st0 = H2_CS_FRAME_E;
return 0;
/* RFC7540#4.2 */
h2c_error(h2c, H2_ERR_FRAME_SIZE_ERROR); // empty headers frame!
goto fail;
}
if (b_data(&h2c->dbuf) < h2c->dfl && !b_full(&h2c->dbuf))