[MEDIUM] merge inspect_exp and txn->exp into request buffer
Since we may have several analysers on a buffer, it's more convenient to have the analyser timeout attached to the buffer itself.
This commit is contained in:
parent
c7e961e5f7
commit
ffab5b4ab0
@ -87,6 +87,7 @@ struct buffer {
|
||||
char *r, *w, *lr; /* read ptr, write ptr, last read */
|
||||
char *rlim; /* read limit, used for header rewriting */
|
||||
unsigned int analysers; /* bit field indicating what to do on the buffer */
|
||||
int analyse_exp; /* expiration date for current analysers (if set) */
|
||||
unsigned char xfer_large; /* number of consecutive large xfers */
|
||||
unsigned char xfer_small; /* number of consecutive small xfers */
|
||||
unsigned long long total; /* total data read */
|
||||
|
@ -243,7 +243,6 @@ struct http_txn {
|
||||
char *srv_cookie; /* cookie presented by the server, in capture mode */
|
||||
int status; /* HTTP status from the server, negative if from proxy */
|
||||
unsigned int flags; /* transaction flags */
|
||||
int exp; /* expiration date for the transaction (generally a request), int ticks */
|
||||
};
|
||||
|
||||
/* This structure is used by http_find_header() to return values of headers.
|
||||
|
@ -172,7 +172,6 @@ struct session {
|
||||
struct server *prev_srv; /* the server the was running on, after a redispatch, otherwise NULL */
|
||||
struct pendconn *pend_pos; /* if not NULL, points to the position in the pending queue */
|
||||
struct http_txn txn; /* current HTTP transaction being processed. Should become a list. */
|
||||
int inspect_exp; /* expiration date for data to be inspected, in ticks */
|
||||
struct {
|
||||
int logwait; /* log fields waiting to be collected : LW_* */
|
||||
struct timeval accept_date; /* date of the accept() in user date */
|
||||
|
@ -353,10 +353,10 @@ int event_accept(int fd) {
|
||||
|
||||
s->req->rex = TICK_ETERNITY;
|
||||
s->req->wex = TICK_ETERNITY;
|
||||
s->req->analyse_exp = TICK_ETERNITY;
|
||||
s->rep->rex = TICK_ETERNITY;
|
||||
s->rep->wex = TICK_ETERNITY;
|
||||
s->txn.exp = TICK_ETERNITY;
|
||||
s->inspect_exp = TICK_ETERNITY;
|
||||
s->rep->analyse_exp = TICK_ETERNITY;
|
||||
t->expire = TICK_ETERNITY;
|
||||
|
||||
fd_insert(cfd);
|
||||
|
@ -767,12 +767,8 @@ void process_session(struct task *t, int *next)
|
||||
|
||||
t->expire = tick_first(tick_first(s->req->rex, s->req->wex),
|
||||
tick_first(s->rep->rex, s->rep->wex));
|
||||
if (s->req->analysers) {
|
||||
if (s->req->analysers & AN_REQ_INSPECT)
|
||||
t->expire = tick_first(t->expire, s->inspect_exp);
|
||||
else if (s->req->analysers & AN_REQ_HTTP_HDR)
|
||||
t->expire = tick_first(t->expire, s->txn.exp);
|
||||
}
|
||||
if (s->req->analysers)
|
||||
t->expire = tick_first(t->expire, s->req->analyse_exp);
|
||||
|
||||
/* restore t to its place in the task list */
|
||||
task_queue(t);
|
||||
@ -1661,7 +1657,6 @@ int process_request(struct session *t)
|
||||
*/
|
||||
if (req->flags & BF_READ_ERROR) {
|
||||
req->analysers = 0;
|
||||
t->inspect_exp = TICK_ETERNITY;
|
||||
t->fe->failed_req++;
|
||||
if (!(t->flags & SN_ERR_MASK))
|
||||
t->flags |= SN_ERR_CLICL;
|
||||
@ -1673,7 +1668,6 @@ int process_request(struct session *t)
|
||||
/* Abort if client read timeout has expired */
|
||||
else if (req->flags & BF_READ_TIMEOUT) {
|
||||
req->analysers = 0;
|
||||
t->inspect_exp = TICK_ETERNITY;
|
||||
t->fe->failed_req++;
|
||||
if (!(t->flags & SN_ERR_MASK))
|
||||
t->flags |= SN_ERR_CLITO;
|
||||
@ -1692,8 +1686,7 @@ int process_request(struct session *t)
|
||||
* - if one rule returns KO, then return KO
|
||||
*/
|
||||
|
||||
if (req->flags & (BF_READ_NULL | BF_SHUTR) ||
|
||||
tick_is_expired(t->inspect_exp, now_ms))
|
||||
if (req->flags & (BF_READ_NULL | BF_SHUTR) || tick_is_expired(req->analyse_exp, now_ms))
|
||||
partial = 0;
|
||||
else
|
||||
partial = ACL_PARTIAL;
|
||||
@ -1705,8 +1698,8 @@ int process_request(struct session *t)
|
||||
ret = acl_exec_cond(rule->cond, t->fe, t, NULL, ACL_DIR_REQ | partial);
|
||||
if (ret == ACL_PAT_MISS) {
|
||||
/* just set the request timeout once at the beginning of the request */
|
||||
if (!tick_isset(t->inspect_exp))
|
||||
t->inspect_exp = tick_add_ifset(now_ms, t->fe->tcp_req.inspect_delay);
|
||||
if (!tick_isset(req->analyse_exp))
|
||||
req->analyse_exp = tick_add_ifset(now_ms, t->fe->tcp_req.inspect_delay);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1728,7 +1721,6 @@ int process_request(struct session *t)
|
||||
t->flags |= SN_ERR_PRXCOND;
|
||||
if (!(t->flags & SN_FINST_MASK))
|
||||
t->flags |= SN_FINST_R;
|
||||
t->inspect_exp = TICK_ETERNITY;
|
||||
return 0;
|
||||
}
|
||||
/* otherwise accept */
|
||||
@ -1740,7 +1732,7 @@ int process_request(struct session *t)
|
||||
* we have an explicit accept, so we apply the default accept.
|
||||
*/
|
||||
req->analysers &= ~AN_REQ_INSPECT;
|
||||
t->inspect_exp = TICK_ETERNITY;
|
||||
req->analyse_exp = TICK_ETERNITY;
|
||||
}
|
||||
|
||||
if (req->analysers & AN_REQ_HTTP_HDR) {
|
||||
@ -1834,7 +1826,7 @@ int process_request(struct session *t)
|
||||
}
|
||||
|
||||
/* 3: has the read timeout expired ? */
|
||||
else if (req->flags & BF_READ_TIMEOUT || tick_is_expired(txn->exp, now_ms)) {
|
||||
else if (req->flags & BF_READ_TIMEOUT || tick_is_expired(req->analyse_exp, now_ms)) {
|
||||
/* read timeout : give up with an error message. */
|
||||
txn->status = 408;
|
||||
client_retnclose(t, error_message(t, HTTP_ERR_408));
|
||||
@ -1862,8 +1854,8 @@ int process_request(struct session *t)
|
||||
}
|
||||
|
||||
/* just set the request timeout once at the beginning of the request */
|
||||
if (!tick_isset(t->txn.exp))
|
||||
t->txn.exp = tick_add_ifset(now_ms, t->fe->timeout.httpreq);
|
||||
if (!tick_isset(req->analyse_exp))
|
||||
req->analyse_exp = tick_add_ifset(now_ms, t->fe->timeout.httpreq);
|
||||
|
||||
/* we're not ready yet */
|
||||
return 0;
|
||||
@ -1877,6 +1869,7 @@ int process_request(struct session *t)
|
||||
****************************************************************/
|
||||
|
||||
req->analysers &= ~AN_REQ_HTTP_HDR;
|
||||
req->analyse_exp = TICK_ETERNITY;
|
||||
|
||||
/* ensure we keep this pointer to the beginning of the message */
|
||||
msg->sol = req->data + msg->som;
|
||||
@ -2573,6 +2566,7 @@ int process_request(struct session *t)
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,8 +496,10 @@ int uxst_event_accept(int fd) {
|
||||
|
||||
s->req->rex = TICK_ETERNITY;
|
||||
s->req->wex = TICK_ETERNITY;
|
||||
s->req->analyse_exp = TICK_ETERNITY;
|
||||
s->rep->rex = TICK_ETERNITY;
|
||||
s->rep->wex = TICK_ETERNITY;
|
||||
s->rep->analyse_exp = TICK_ETERNITY;
|
||||
|
||||
s->req->wto = TICK_ETERNITY;
|
||||
s->req->cto = TICK_ETERNITY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user