From: Aleksandar Lazic Date: Wed, 21 Oct 2026 20:25:18 +0000 (+0200) Subject: BUG/MINOR: http-ana: call the http_reset filter callback on L7 retries X-Git-Tag: v3.5-dev10~71 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=86f56cca7100958c95dfa8441a936127dde54a1d;p=haproxy.git BUG/MINOR: http-ana: call the http_reset filter callback on L7 retries The filters documentation says that the http_reset callback is called when the request is sent again to the server for a L7 retry, but it was only called for the 1xx informational responses. It was documented with the L7 retries in commit a254a37ad ("MEDIUM: streams: Add the ability to retry a request on L7 failure."), but never called on this path. do_l7_retry() now calls it for the response, once sc_reset_endp() succeeded so that the retry is certain, and before the L7 buffer swap, while the failed response is still in the buffer and txn->status is set, like for the 1xx responses. The request is sent again as is from the L7 buffer and its callbacks are not called again, so it is not reset. The documentation now tells it. This patch could be backported to all stable versions. Signed-off-by: Aleksandar Lazic --- diff --git a/doc/internals/api/filters.txt b/doc/internals/api/filters.txt index 5a83505f5..87898b45d 100644 --- a/doc/internals/api/filters.txt +++ b/doc/internals/api/filters.txt @@ -1578,6 +1578,9 @@ Then, to finish, there are 2 informational callbacks : By checking s->txn.http->status, it is possible to know why this callback is called. If it's a 1xx, we're called because of an informational message. Otherwise, it is a L7 retry. + On a L7 retry, it is only called for the response, once the retry is + certain, while the failed response, if any, is still in the channel buffer. + The request is sent again as is, so its callbacks are not called again. * 'flt_ops.http_reply' : This callback is called when, at any time, HAProxy decides to stop the processing on a HTTP message and to send an internal diff --git a/src/filters.c b/src/filters.c index fc521b811..698ddfafd 100644 --- a/src/filters.c +++ b/src/filters.c @@ -1331,7 +1331,8 @@ end: /* * Calls 'http_reset' callback for all filters attached to a stream. This - * happens when a 100-continue response is received. + * happens when a 1xx informational response is received, and on the response + * when the request is sent again for a L7 retry. */ void flt_http_reset(struct stream *s, struct http_msg *msg) diff --git a/src/http_ana.c b/src/http_ana.c index 397680595..f17a40fc5 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1225,6 +1225,12 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc) return -1; } + /* The retry is now certain: notify the filters that the response is + * reset, while the failed one is still in the buffer. The request is + * sent again as is from the L7 buffer, so it is not reset. + */ + FLT_STRM_CB(s, flt_http_reset(s, &s->txn.http->rsp)); + b_free(&req->buf); /* Swap the L7 buffer with the channel buffer */