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 <al-haproxy@none.at>
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
/*
* 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)
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 */