From e9bacf642d12f6da195617f54f3c44e501902420 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 29 Mar 2023 10:23:21 +0200 Subject: [PATCH] MINOR: mux-h1: Report an error to the SE descriptor on truncated message 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 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 1292661fa..511570496 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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) {