MEDIUM: backend: add the "http-reuse aggressive" strategy
This strategy is less extreme than "always", it only dispatches first
requests to validated reused connections, and moves a connection from
the idle list to the safe list once it has seen a second request, thus
proving that it could be reused.
diff --git a/src/proto_http.c b/src/proto_http.c
index 02ff485..c7ed011 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -5032,6 +5032,7 @@
struct proxy *fe = strm_fe(s);
struct connection *srv_conn;
struct server *srv;
+ unsigned int prev_flags = s->txn->flags;
/* FIXME: We need a more portable way of releasing a backend's and a
* server's connections. We need a safer way to reinitialize buffer
@@ -5194,6 +5195,12 @@
else if ((srv_conn->flags & CO_FL_PRIVATE) ||
((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR))
si_idle_conn(&s->si[1], &srv->priv_conns);
+ else if (prev_flags & TX_NOT_FIRST)
+ /* note: we check the request, not the connection, but
+ * this is valid for strategies SAFE and AGGR, and in
+ * case of ALWS, we don't care anyway.
+ */
+ si_idle_conn(&s->si[1], &srv->safe_conns);
else
si_idle_conn(&s->si[1], &srv->idle_conns);
}