]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Report an error to the SE descriptor on truncated message
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 29 Mar 2023 08:23:21 +0000 (10:23 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:57:05 +0000 (08:57 +0200)
On truncated message, a parsing error is still reported. But an error on the
SE descriptor is also reported. This will avoid any bugs in future. We are
know sure the SC is able to detect the error, independently on the HTTP
analyzers.

src/mux_h1.c

index 1292661fa63fd70ab151eadda415040263e2aa7e..511570496ca2b8fb97c104aacdc366ddfec5677e 100644 (file)
@@ -1916,15 +1916,10 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
                                TRACE_STATE("report EOI to SE", H1_EV_RX_DATA, h1c->conn, h1s);
                        }
                        else if (h1m->state < H1_MSG_DONE) {
-                               if (h1m->state > H1_MSG_LAST_LF) {
-                                       se_fl_set(h1s->sd, SE_FL_ERROR);
-                                       TRACE_ERROR("message aborted, set error on SC", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s);
-                               }
-                               else if (b_data(&h1c->ibuf)) {
+                               if (h1m->state <= H1_MSG_LAST_LF && b_data(&h1c->ibuf))
                                        htx->flags |= HTX_FL_PARSING_ERROR;
-                                       TRACE_ERROR("truncated message, set error on SC", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s);
-                               }
-                               /* Otherwise (no data was never received) don't report any error just EOS */
+                               se_fl_set(h1s->sd, SE_FL_ERROR);
+                               TRACE_ERROR("message aborted, set error on SC", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s);
                        }
 
                        if (h1s->flags & H1S_F_TX_BLK) {