]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http-ana: Reset request analysers on a response side error
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 2 Mar 2020 15:21:01 +0000 (16:21 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Mar 2020 13:12:59 +0000 (14:12 +0100)
When an error occurred on the response side, request analysers must be reset. At
this stage, only AN_REQ_HTTP_XFER_BODY analyser remains, and possibly
AN_REQ_FLT_END, if at least one filter is attached to the stream. So it is safe
to remove the AN_REQ_HTTP_XFER_BODY analyser. An error was already handled and a
response was already returned to the client (or it was at least scheduled to be
sent). So there is no reason to continue to process the request payload. It may
cause some troubles for the filters because when an error occurred, data from
the request buffer are truncated.

This patch must be backported as far as 1.9, for the HTX part only. I don't know
if the legacy HTTP code is affected.

src/http_ana.c

index b9067dd0c4841575f01cb666d46ebf6c608855a5..4d85c9f315ff0c7c200180216d2823f2f31bc3c6 100644 (file)
@@ -1880,6 +1880,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
 
        s->si[1].flags |= SI_FL_NOLINGER;
        rep->analysers &= AN_RES_FLT_END;
+       s->req.analysers &= AN_REQ_FLT_END;
        rep->analyse_exp = TICK_ETERNITY;
        DBG_TRACE_DEVEL("leaving on error",
                        STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
@@ -2184,7 +2185,8 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
        if (!(s->flags & SF_FINST_MASK))
                s->flags |= SF_FINST_H;
 
-       rep->analysers &= ~an_bit;
+       rep->analysers &= AN_RES_FLT_END;
+       s->req.analysers &= AN_REQ_FLT_END;
        rep->analyse_exp = TICK_ETERNITY;
        DBG_TRACE_DEVEL("leaving on error",
                        STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);