]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: filters: Do not reset stream analyzers if the client is gone
authorChristopher Faulet <cfaulet@qualys.com>
Tue, 22 Dec 2015 11:01:29 +0000 (12:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Feb 2016 13:53:15 +0000 (14:53 +0100)
When all callbacks have been called for all filters registered on a stream, if
we are waiting for the next HTTP request, we must reset stream analyzers. But it
is useless to do so if the client has already closed the connection.

src/filters.c

index ab88f23b9f17e80d647b36813855ce36b845083d..b4af33be7a5ee73c50250f65c6de1a62b5d04710 100644 (file)
@@ -687,13 +687,19 @@ flt_end_analyze(struct stream *s, struct channel *chn, unsigned int an_bit)
 
 end:
        ret = handle_analyzer_result(s, chn, an_bit, ret);
-       if (!(s->req.analysers & AN_FLT_END) &&
-           !(s->res.analysers & AN_FLT_END) &&
-           s->txn && (s->txn->flags & TX_WAIT_NEXT_RQ)) {
+
+       /* Check if 'channel_end_analyze' callback has been called for the
+        * request and the response. */
+       if (!(s->req.analysers & AN_FLT_END) && !(s->res.analysers & AN_FLT_END)) {
                struct filter *filter, *back;
 
-               s->req.analysers = strm_li(s) ? strm_li(s)->analysers : 0;
-               s->res.analysers = 0;
+               /* When we are waiting for a new request, so we must reset
+                * stream analyzers. The input must not be closed the request
+                * channel, else it is useless to wait. */
+               if (s->txn && (s->txn->flags & TX_WAIT_NEXT_RQ) && !channel_input_closed(&s->req)) {
+                       s->req.analysers = strm_li(s) ? strm_li(s)->analysers : 0;
+                       s->res.analysers = 0;
+               }
 
                list_for_each_entry_safe(filter, back, &s->strm_flt.filters, list) {
                        if (filter->is_backend_filter) {