From 486498c630a0678446808107d02f94c48fc6722a Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 11 Oct 2019 14:22:00 +0200 Subject: [PATCH] BUG/MINOR: mux-h1: Capture ignored parsing errors When the option "accept-invalid-http-request" is enabled, some parsing errors are ignored. But the position of the error is reported. In legacy HTTP mode, such errors were captured. So, we now do the same in the H1 multiplexer. If required, this patch may be backported to 2.0 and 1.9. --- src/mux_h1.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mux_h1.c b/src/mux_h1.c index ac520a42d..b9b78f0b6 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1191,6 +1191,15 @@ static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *h goto end; } + if (h1m->err_pos >= 0) { + /* Maybe we found an error during the parsing while we were + * configured not to block on that, so we have to capture it + * now. + */ + TRACE_STATE("Ignored parsing error", H1_EV_RX_DATA|H1_EV_RX_HDRS, h1s->h1c->conn, h1s); + h1_capture_bad_message(h1s->h1c, h1s, h1m, buf); + } + if (!(h1m->flags & H1_MF_RESP)) { h1s->meth = h1sl.rq.meth; if (h1m->state == H1_MSG_TUNNEL) {