]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Capture ignored parsing errors
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 11 Oct 2019 12:22:00 +0000 (14:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Oct 2019 20:28:50 +0000 (22:28 +0200)
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

index ac520a42df9f301a536d3bdd59bb9d680277e141..b9b78f0b6777ce9bb993bbac92b0313b816210d6 100644 (file)
@@ -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) {