From: Willy Tarreau Date: Sun, 16 Aug 2009 20:57:50 +0000 (+0200) Subject: [MEDIUM] set rep->analysers from fe and be analysers X-Git-Tag: v1.4-dev3~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e5b8287a6fe500fc0af6c68635a05d69cecf40b;p=thirdparty%2Fhaproxy.git [MEDIUM] set rep->analysers from fe and be analysers sess_establish() used to resort to protocol-specific guesses in order to set rep->analysers. This is no longer needed as it gets set from the frontend and the backend as a copy of what was defined in the configuration. --- diff --git a/include/types/proxy.h b/include/types/proxy.h index 69505e6059..c2323f65c6 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -151,6 +151,7 @@ struct proxy { int options; /* PR_O_REDISP, PR_O_TRANSP, ... */ int options2; /* PR_O2_* */ unsigned int fe_req_ana, be_req_ana; /* bitmap of common request protocol analysers for the frontend and backend */ + unsigned int fe_rsp_ana, be_rsp_ana; /* bitmap of common response protocol analysers for the frontend and backend */ int mode; /* mode = PR_MODE_TCP, PR_MODE_HTTP or PR_MODE_HEALTH */ struct sockaddr_in dispatch_addr; /* the default address to connect to */ union { diff --git a/src/cfgparse.c b/src/cfgparse.c index cddca1e845..a6b9f07ce3 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4144,16 +4144,20 @@ int check_config_validity() !LIST_ISEMPTY(&curproxy->tcp_req.inspect_rules)) curproxy->fe_req_ana |= AN_REQ_INSPECT; - if (curproxy->mode == PR_MODE_HTTP) + if (curproxy->mode == PR_MODE_HTTP) { curproxy->fe_req_ana |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_FE; + curproxy->fe_rsp_ana |= AN_RTR_HTTP_HDR; + } /* both TCP and HTTP must check switching rules */ curproxy->fe_req_ana |= AN_REQ_SWITCHING_RULES; } if (curproxy->cap & PR_CAP_BE) { - if (curproxy->mode == PR_MODE_HTTP) + if (curproxy->mode == PR_MODE_HTTP) { curproxy->be_req_ana |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_INNER | AN_REQ_HTTP_PROCESS_BE; + curproxy->be_rsp_ana |= AN_RTR_HTTP_HDR; + } /* If the backend does requires RDP cookie persistence, we have to * enable the corresponding analyser. diff --git a/src/session.c b/src/session.c index 809ee2bd10..33109d6c1a 100644 --- a/src/session.c +++ b/src/session.c @@ -330,7 +330,6 @@ void sess_establish(struct session *s, struct stream_interface *si) } } else { - rep->analysers |= AN_RTR_HTTP_HDR; buffer_set_rlim(rep, BUFSIZE - MAXREWRITE); /* rewrite needed */ s->txn.rsp.msg_state = HTTP_MSG_RPBEFORE; /* reset hdr_idx which was already initialized by the request. @@ -339,6 +338,7 @@ void sess_establish(struct session *s, struct stream_interface *si) */ } + rep->analysers |= s->fe->fe_rsp_ana | s->be->be_rsp_ana; rep->flags |= BF_READ_ATTACHED; /* producer is now attached */ req->wex = TICK_ETERNITY; }