From 02c7b22267c838313b9a1d2e17dee080404a848b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 22 Dec 2015 12:01:29 +0100 Subject: [PATCH] MINOR: filters: Do not reset stream analyzers if the client is gone 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/filters.c b/src/filters.c index ab88f23b9..b4af33be7 100644 --- a/src/filters.c +++ b/src/filters.c @@ -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) {