|
commit cf2f1243373be97249567ffd259e975cc87068b8
|
|
Author: Christopher Faulet <cfaulet@haproxy.com>
|
|
Date: Mon Apr 29 13:12:02 2019 +0200
|
|
|
|
BUG/MINOR: http: Call stream_inc_be_http_req_ctr() only one time per request
|
|
|
|
The function stream_inc_be_http_req_ctr() is called at the beginning of the
|
|
analysers AN_REQ_HTTP_PROCESS_FE/BE. It as an effect only on the backend. But we
|
|
must be careful to call it only once. If the processing of HTTP rules is
|
|
interrupted in the middle, when the analyser is resumed, we must not call it
|
|
again. Otherwise, the tracked counters of the backend are incremented several
|
|
times.
|
|
|
|
This bug was reported in github. See issue #74.
|
|
|
|
This fix should be backported as far as 1.6.
|
|
|
|
(cherry picked from commit 1907ccc2f75b78ace1ee4acdfc60d48a76e3decd)
|
|
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
|
|
(cherry picked from commit 319921866ea9ecc46215fea5679abc8efdfcbea5)
|
|
[cf: HTX part was removed]
|
|
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
|
|
|
|
diff --git a/src/proto_http.c b/src/proto_http.c
|
|
index ccacd6a4..556cabad 100644
|
|
--- a/src/proto_http.c
|
|
+++ b/src/proto_http.c
|
|
@@ -3420,8 +3420,10 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|
req->buf->i,
|
|
req->analysers);
|
|
|
|
- /* just in case we have some per-backend tracking */
|
|
- stream_inc_be_http_req_ctr(s);
|
|
+ /* just in case we have some per-backend tracking. Only called the first
|
|
+ * execution of the analyser. */
|
|
+ if (!s->current_rule || s->current_rule_list != &px->http_req_rules)
|
|
+ stream_inc_be_http_req_ctr(s);
|
|
|
|
/* evaluate http-request rules */
|
|
if (!LIST_ISEMPTY(&px->http_req_rules)) {
|