]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] process_request: HTTP body analysis must return zero if missing data
authorWilly Tarreau <w@1wt.eu>
Sun, 17 Aug 2008 17:17:57 +0000 (19:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 17 Aug 2008 17:27:11 +0000 (19:27 +0200)
This missing return and timeout check caused an infinite loop too.

src/proto_http.c

index 192b071545c7dd1ac39d3e8cb80ca3693812ed34..95f12a5c0fcf68409ccf6d9f88404334637e5aec 100644 (file)
@@ -2562,12 +2562,24 @@ int process_request(struct session *t)
                 * buffer closed).
                 */
                if (req->l - body >= limit ||             /* enough bytes! */
-                   req->flags & (BF_FULL | BF_READ_ERROR | BF_READ_NULL | BF_READ_TIMEOUT)) {
+                   req->flags & (BF_FULL | BF_READ_ERROR | BF_READ_NULL | BF_READ_TIMEOUT) ||
+                   tick_is_expired(req->analyse_exp, now_ms)) {
                        /* The situation will not evolve, so let's give up on the analysis. */
                        t->logs.tv_request = now;  /* update the request timer to reflect full request */
                        req->analysers &= ~AN_REQ_HTTP_BODY;
                        req->analyse_exp = TICK_ETERNITY;
                }
+               else {
+                       /* Not enough data. We'll re-use the http-request
+                        * timeout here. Ideally, we should set the timeout
+                        * relative to the accept() date. We just set the
+                        * request timeout once at the beginning of the
+                        * request.
+                        */
+                       if (!tick_isset(req->analyse_exp))
+                               req->analyse_exp = tick_add_ifset(now_ms, t->fe->timeout.httpreq);
+                       return 0;
+               }
        }
 
        /* Note: eventhough nobody should set an unknown flag, clearing them right now will