int state; /* proxy state */
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 */
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 {
newsrv = newsrv->next;
}
+ if (curproxy->cap & PR_CAP_FE) {
+ if (curproxy->tcp_req.inspect_delay ||
+ !LIST_ISEMPTY(&curproxy->tcp_req.inspect_rules))
+ curproxy->fe_req_ana |= AN_REQ_INSPECT;
+
+ if (curproxy->mode == PR_MODE_HTTP)
+ curproxy->fe_req_ana |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_FE;
+
+ /* 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)
+ curproxy->be_req_ana |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_INNER | AN_REQ_HTTP_PROCESS_BE;
+
+ /* If the backend does requires RDP cookie persistence, we have to
+ * enable the corresponding analyser.
+ */
+ if (curproxy->options2 & PR_O2_RDPC_PRST)
+ curproxy->be_req_ana |= AN_REQ_PRST_RDP_COOKIE;
+ }
+
/* adjust this proxy's listeners */
listener = curproxy->listen;
while (listener) {
listener->accept = event_accept;
listener->private = curproxy;
listener->handler = process_session;
- /* both TCP and HTTP must check switching rules */
- listener->analysers |= AN_REQ_SWITCHING_RULES;
-
- if (curproxy->mode == PR_MODE_HTTP)
- listener->analysers |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_FE | AN_REQ_HTTP_INNER | AN_REQ_HTTP_PROCESS_BE;
+ listener->analysers |= curproxy->fe_req_ana;
/* smart accept mode is automatic in HTTP mode */
if ((curproxy->options2 & PR_O2_SMARTACC) ||
!(curproxy->no_options2 & PR_O2_SMARTACC)))
listener->options |= LI_O_NOQUICKACK;
- if (curproxy->tcp_req.inspect_delay ||
- !LIST_ISEMPTY(&curproxy->tcp_req.inspect_rules))
- listener->analysers |= AN_REQ_INSPECT;
-
/* We want the use_backend and default_backend rules to apply */
listener = listener->next;
}
hdr_idx_init(&s->txn.hdr_idx);
}
- /* If we're switching from TCP mode to HTTP mode, we need to
- * enable several analysers on the backend.
+ /* We want to enable the backend-specific analysers except those which
+ * were already run as part of the frontend/listener. Note that it would
+ * be more reliable to store the list of analysers that have been run,
+ * but what we do here is OK for now.
*/
- if (unlikely(s->fe->mode != PR_MODE_HTTP && s->be->mode == PR_MODE_HTTP)) {
- /* We want to wait for a complete HTTP request and process the
- * backend parts.
- */
- s->req->analysers |= AN_REQ_WAIT_HTTP | AN_REQ_HTTP_PROCESS_BE | AN_REQ_HTTP_INNER;
- }
-
- /* If the backend does requires RDP cookie persistence, we have to
- * enable the corresponding analyser.
- */
- if (s->be->options2 & PR_O2_RDPC_PRST)
- s->req->analysers |= AN_REQ_PRST_RDP_COOKIE;
+ s->req->analysers |= be->be_req_ana & ~(s->listener->analysers);
return 1;
}