From: Willy Tarreau Date: Sun, 17 Aug 2008 17:17:57 +0000 (+0200) Subject: [BUG] process_request: HTTP body analysis must return zero if missing data X-Git-Tag: v1.3.16-rc1~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c52164a1a8e46840531d04212337204cea6bdc89;p=thirdparty%2Fhaproxy.git [BUG] process_request: HTTP body analysis must return zero if missing data This missing return and timeout check caused an infinite loop too. --- diff --git a/src/proto_http.c b/src/proto_http.c index 192b071545..95f12a5c0f 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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