[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 78f305f..0cad6e8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -648,6 +648,7 @@
{
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 @@
}
}
+ /* 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 @@
}
}
+ /* 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.
*/