Merge pull request #8518 from neheb/i
[feed/packages.git] / net / haproxy / patches / 000-BUG-MINOR-http-Call-stream_inc_be_http_req_ctr-only-one-time-per-request.patch
1 commit cf2f1243373be97249567ffd259e975cc87068b8
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date: Mon Apr 29 13:12:02 2019 +0200
4
5 BUG/MINOR: http: Call stream_inc_be_http_req_ctr() only one time per request
6
7 The function stream_inc_be_http_req_ctr() is called at the beginning of the
8 analysers AN_REQ_HTTP_PROCESS_FE/BE. It as an effect only on the backend. But we
9 must be careful to call it only once. If the processing of HTTP rules is
10 interrupted in the middle, when the analyser is resumed, we must not call it
11 again. Otherwise, the tracked counters of the backend are incremented several
12 times.
13
14 This bug was reported in github. See issue #74.
15
16 This fix should be backported as far as 1.6.
17
18 (cherry picked from commit 1907ccc2f75b78ace1ee4acdfc60d48a76e3decd)
19 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
20 (cherry picked from commit 319921866ea9ecc46215fea5679abc8efdfcbea5)
21 [cf: HTX part was removed]
22 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
23
24 diff --git a/src/proto_http.c b/src/proto_http.c
25 index ccacd6a4..556cabad 100644
26 --- a/src/proto_http.c
27 +++ b/src/proto_http.c
28 @@ -3420,8 +3420,10 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
29 req->buf->i,
30 req->analysers);
31
32 - /* just in case we have some per-backend tracking */
33 - stream_inc_be_http_req_ctr(s);
34 + /* just in case we have some per-backend tracking. Only called the first
35 + * execution of the analyser. */
36 + if (!s->current_rule || s->current_rule_list != &px->http_req_rules)
37 + stream_inc_be_http_req_ctr(s);
38
39 /* evaluate http-request rules */
40 if (!LIST_ISEMPTY(&px->http_req_rules)) {