]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h2: make empty HEADERS frame return a connection error
authorWilly Tarreau <w@1wt.eu>
Sun, 23 Dec 2018 07:13:59 +0000 (08:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 23 Dec 2018 09:02:38 +0000 (10:02 +0100)
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.

src/mux_h2.c

index 5ad32147adc18580f917eacda6aa597a91f2d583..03c900da10614111ba86d747413516e0c6f17ac9 100644 (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))