MINOR: filters/http-ana: Decide to filter HTTP headers in HTTP analysers
It is just a small cleanup. AN_REQ_FLT_HTTP_HDRS and AN_RES_FLT_HTTP_HDRS
analysers are now set in HTTP analysers at the same place
AN_REQ_HTTP_XFER_BODY and AN_RES_HTTP_XFER_BODY are set.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 0cffdbb..2682fba 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -3207,10 +3207,6 @@
if (!LIST_ISEMPTY(&curproxy->filter_configs)) {
curproxy->fe_req_ana |= AN_REQ_FLT_START_FE | AN_REQ_FLT_XFER_DATA | AN_REQ_FLT_END;
curproxy->fe_rsp_ana |= AN_RES_FLT_START_FE | AN_RES_FLT_XFER_DATA | AN_RES_FLT_END;
- if (curproxy->mode == PR_MODE_HTTP) {
- curproxy->fe_req_ana |= AN_REQ_FLT_HTTP_HDRS;
- curproxy->fe_rsp_ana |= AN_RES_FLT_HTTP_HDRS;
- }
}
}
@@ -3237,10 +3233,6 @@
if (!LIST_ISEMPTY(&curproxy->filter_configs)) {
curproxy->be_req_ana |= AN_REQ_FLT_START_BE | AN_REQ_FLT_XFER_DATA | AN_REQ_FLT_END;
curproxy->be_rsp_ana |= AN_RES_FLT_START_BE | AN_RES_FLT_XFER_DATA | AN_RES_FLT_END;
- if (curproxy->mode == PR_MODE_HTTP) {
- curproxy->be_req_ana |= AN_REQ_FLT_HTTP_HDRS;
- curproxy->be_rsp_ana |= AN_RES_FLT_HTTP_HDRS;
- }
}
}
diff --git a/src/http_ana.c b/src/http_ana.c
index a13c946..b0067c3 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -452,6 +452,9 @@
if (!(s->flags & SF_FINST_MASK))
s->flags |= SF_FINST_R;
+ if (HAS_FILTERS(s))
+ req->analysers |= AN_REQ_FLT_HTTP_HDRS;
+
/* enable the minimally required analyzers to handle keep-alive and compression on the HTTP response */
req->analysers &= (AN_REQ_HTTP_BODY | AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END);
req->analysers &= ~AN_REQ_FLT_XFER_DATA;
@@ -777,6 +780,12 @@
}
}
+ /* Filter the request headers if there are filters attached to the
+ * stream.
+ */
+ if (HAS_FILTERS(s))
+ req->analysers |= AN_REQ_FLT_HTTP_HDRS;
+
/* If we have no server assigned yet and we're balancing on url_param
* with a POST request, we may be interested in checking the body for
* that parameter. This will be done in another analyser.
@@ -2071,6 +2080,12 @@
if (!http_eval_after_res_rules(s))
goto return_int_err;
+ /* Filter the response headers if there are filters attached to the
+ * stream.
+ */
+ if (HAS_FILTERS(s))
+ rep->analysers |= AN_RES_FLT_HTTP_HDRS;
+
/* Always enter in the body analyzer */
rep->analysers &= ~AN_RES_FLT_XFER_DATA;
rep->analysers |= AN_RES_HTTP_XFER_BODY;
diff --git a/src/proxy.c b/src/proxy.c
index 234515d..d044150 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -2153,11 +2153,6 @@
http_init_txn(s);
}
- /* Be sure to filter request headers if the backend is an HTTP proxy and
- * if there are filters attached to the stream. */
- if (s->be->mode == PR_MODE_HTTP && HAS_FILTERS(s))
- s->req.analysers |= AN_REQ_FLT_HTTP_HDRS;
-
if (s->txn) {
/* If we chain a TCP frontend to an HTX backend, we must upgrade
* the client mux */
diff --git a/src/stream.c b/src/stream.c
index c1ba905..eb64807 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -933,11 +933,6 @@
rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana;
- /* Be sure to filter response headers if the backend is an HTTP proxy
- * and if there are filters attached to the stream. */
- if (IS_HTX_STRM(s) && HAS_FILTERS(s))
- rep->analysers |= AN_RES_FLT_HTTP_HDRS;
-
si_rx_endp_more(si);
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
if (objt_cs(si->end)) {