BUG/MINOR: http-ana: Reset HTX first index when HAPRoxy sends a response
The first index in an HTX message is the HTX block index from which the HTTP
analysis must be performed. When HAProxy sends an HTTP response, on error or
redirect, this index must be reset because all pending incoming data are
considered as forwarded. For now, it is only a bug for 103-Early-Hints
response. For other responses, it is not a problem. But it will be when the new
ruleset applied on all responses will be added. For 103 responses, if the first
index is not reset, if there are rewritting rules on server responses, the
generated 103 responses, if any, are evaluated too.
This patch must be backported and probably adapted, at least for 103 responses,
as far as 1.9.
diff --git a/src/http_act.c b/src/http_act.c
index 5d3d2e2..67eca31 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -1125,6 +1125,7 @@
data = htx->data - co_data(res);
c_adv(res, data);
+ htx->first = -1;
res->total += data;
}
diff --git a/src/http_ana.c b/src/http_ana.c
index a276527..eac5944 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -2669,6 +2669,7 @@
htx->flags |= HTX_FL_PROXY_RESP;
data = htx->data - co_data(res);
c_adv(res, data);
+ htx->first = -1;
res->total += data;
channel_auto_read(req);
@@ -4258,6 +4259,7 @@
*/
data = htx->data - co_data(res);
c_adv(res, data);
+ htx->first = -1;
res->total += data;
/* return without error. */
@@ -4564,6 +4566,7 @@
htx->flags |= HTX_FL_PROXY_RESP;
data = htx->data - co_data(chn);
c_adv(chn, data);
+ htx->first = -1;
chn->total += data;
}
}
@@ -4596,6 +4599,7 @@
htx->flags |= HTX_FL_PROXY_RESP;
data = htx->data - co_data(chn);
c_adv(chn, data);
+ htx->first = -1;
chn->total += data;
}
}
@@ -4719,6 +4723,7 @@
data = htx->data - co_data(res);
c_adv(res, data);
+ htx->first = -1;
res->total += data;
return 0;
@@ -4795,6 +4800,7 @@
htx->flags |= HTX_FL_PROXY_RESP;
data = htx->data - co_data(res);
c_adv(res, data);
+ htx->first = -1;
res->total += data;
channel_auto_read(&s->req);