From: Willy Tarreau Date: Fri, 8 Feb 2019 14:35:38 +0000 (+0100) Subject: BUG/MINOR: mux-h1: verify the request's version before dropping connection: keep... X-Git-Tag: v2.0-dev1~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7701cad4449f2a84603c296c7fa3bf1e23c9fcb9;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-h1: verify the request's version before dropping connection: keep-alive The mux h1 properly avoid to set "connection: keep-alive" when the response is in HTTP/1.1 but it forgot to check the request's version. Thus when the client requests using HTTP/1.0 and connection: keep-alive (like ab does), the response is in 1.1 with no keep-alive and ab waits for the close without checking for the content-length. Response headers actually depend on the recipient, thus on both request and response's version. This patch must be backported to 1.9. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 3fe6f95cc0..92eea18679 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -784,13 +784,15 @@ static void h1_update_res_conn_hdr(struct h1s *h1s, struct h1m *h1m, if (htx) h1_remove_conn_hdrs(h1m, htx); } - if (!(h1m->flags & (H1_MF_VER_11|H1_MF_CONN_KAL))) { + if (!(h1m->flags & H1_MF_CONN_KAL) && + !((h1m->flags & h1s->req.flags) & H1_MF_VER_11)) { if (conn_val) *conn_val = ist("keep-alive"); if (htx) h1_add_conn_hdr(h1m, htx, ist("keep-alive")); } - if ((h1m->flags & (H1_MF_VER_11|H1_MF_CONN_KAL)) == (H1_MF_VER_11|H1_MF_CONN_KAL)) { + else if ((h1m->flags & H1_MF_CONN_KAL) && + ((h1m->flags & h1s->req.flags) & H1_MF_VER_11)) { if (conn_val) *conn_val = ist(""); if (htx)