From: Willy Tarreau Date: Wed, 6 Jan 2010 23:09:04 +0000 (+0100) Subject: [MEDIUM] session: also consider request analysers added during response X-Git-Tag: v1.4-dev6~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=576507f4c5e46f377cfe22156e9d3bafdcd4c9f4;p=thirdparty%2Fhaproxy.git [MEDIUM] session: also consider request analysers added during response A request analyser may very well be added while processing a response (eg: end of an HTTP keep-alive response). It's very dangerous to only rely on flags that ought to change in order to loop back, so let's correctly detect a possible new analyser addition instead of guessing. --- diff --git a/src/session.c b/src/session.c index 78f305f812..0cad6e857b 100644 --- a/src/session.c +++ b/src/session.c @@ -648,6 +648,7 @@ struct task *process_session(struct task *t) { struct session *s = t->context; unsigned int rqf_last, rpf_last; + unsigned int req_ana_back; //DPRINTF(stderr, "%s:%d: cs=%d ss=%d(%d) rqf=0x%08x rpf=0x%08x\n", __FUNCTION__, __LINE__, // s->si[0].state, s->si[1].state, s->si[1].err_type, s->req->flags, s->rep->flags); @@ -916,6 +917,12 @@ resync_stream_interface: } } + /* we'll monitor the request analysers while parsing the response, + * because some response analysers may indirectly enable new request + * analysers (eg: HTTP keep-alive). + */ + req_ana_back = s->req->analysers; + resync_response: /* Analyse response */ @@ -990,6 +997,10 @@ resync_stream_interface: } } + /* maybe someone has added some request analysers, so we must check and loop */ + if (s->req->analysers & ~req_ana_back) + goto resync_request; + /* FIXME: here we should call protocol handlers which rely on * both buffers. */