From d17dd848c4eb15948d4894fb00bb0d5cf75f98a3 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 20 Feb 2023 17:30:06 +0100 Subject: [PATCH] MINOR: proxy: Only consider backend httpclose option for server connections For server connections, both the frontend and backend were considered to enable the httpclose option. However, it is ambiguous because on client side only the frontend is considerd. In addition for 2 frontends, one with the option enabled and not for the other, the HTTP connection mode may differ while it is a backend setting. Thus, now, for the server side, only the backend is considered. Of course, if the option is set for a listener, the option will be enabled if the listener is the backend's connection. --- doc/configuration.txt | 6 ++---- src/mux_h1.c | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 73620307c..3b1e29a25 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -9700,10 +9700,8 @@ no option httpclose httpclose". If "option httpclose" is set, HAProxy will close the client or the server - connection, depending where the option is set. Only the frontend is - considered for client connections while the frontend and the backend are - considered for server ones. In this case the option is enabled if at least - one of the frontend or backend holding the connection has it enabled. If the + connection, depending where the option is set. The frontend is considered for + client connections while the backend is considered for server ones. If the option is set on a listener, it is applied both on client and server connections. It will check if a "Connection: close" header is already set in each direction, and will add one if missing. diff --git a/src/mux_h1.c b/src/mux_h1.c index 00538ca32..adf4569f7 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1230,7 +1230,6 @@ static void h1_set_srv_conn_mode(struct h1s *h1s, struct h1m *h1m) else if (!(h1m->flags & H1_MF_CONN_KAL) && ((fe_flags & PR_O_HTTP_MODE) == PR_O_HTTP_SCL || (be->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL || - (fe_flags & PR_O_HTTP_MODE) == PR_O_HTTP_CLO || (be->options & PR_O_HTTP_MODE) == PR_O_HTTP_CLO)) { /* no explicit keep-alive option httpclose/server-close => close */ h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO; -- 2.47.3