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.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 5ad3214..03c900d 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1824,9 +1824,10 @@
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 @@
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 @@
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))