]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] session: also consider request analysers added during response
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Jan 2010 23:09:04 +0000 (00:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Jan 2010 23:09:04 +0000 (00:09 +0100)
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.

src/session.c

index 78f305f8128b5d53b1de6dcbb1cb86398ad005dd..0cad6e857be1a52799834188f59374ac3c3b63b5 100644 (file)
@@ -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.
         */