From: Christopher Faulet Date: Mon, 3 Dec 2018 13:05:01 +0000 (+0100) Subject: BUG/MINOR: htx: Force HTTP/1.1 on H1 formatting when version is 1.1 or above X-Git-Tag: v1.9-dev10~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e7af46aae2416c2229f14092baca0786047eef6;p=thirdparty%2Fhaproxy.git BUG/MINOR: htx: Force HTTP/1.1 on H1 formatting when version is 1.1 or above This only happens for connections using the h1 mux. We must be sure to force the version to HTTP/1.1 when the version of the message is 1.1 or above. It is important for H2 messages to not send an invalid version string (HTTP/2.0) to peers. --- diff --git a/src/htx.c b/src/htx.c index d5285eb6d0..0d7ddc1538 100644 --- a/src/htx.c +++ b/src/htx.c @@ -814,7 +814,11 @@ int htx_reqline_to_h1(const struct htx_sl *sl, struct buffer *chk) chunk_memcat(chk, " ", 1); chunk_memcat(chk, HTX_SL_REQ_UPTR(sl), HTX_SL_REQ_ULEN(sl)); chunk_memcat(chk, " ", 1); - chunk_memcat(chk, HTX_SL_REQ_VPTR(sl), HTX_SL_REQ_VLEN(sl)); + if (sl->flags & HTX_SL_F_VER_11) + chunk_memcat(chk, "HTTP/1.1", 8); + else + chunk_memcat(chk, HTX_SL_REQ_VPTR(sl), HTX_SL_REQ_VLEN(sl)); + chunk_memcat(chk, "\r\n", 2); return 1; @@ -829,7 +833,10 @@ int htx_stline_to_h1(const struct htx_sl *sl, struct buffer *chk) if (HTX_SL_LEN(sl) + 4 > b_size(chk)) return 0; - chunk_memcat(chk, HTX_SL_RES_VPTR(sl), HTX_SL_RES_VLEN(sl)); + if (sl->flags & HTX_SL_F_VER_11) + chunk_memcat(chk, "HTTP/1.1", 8); + else + chunk_memcat(chk, HTX_SL_RES_VPTR(sl), HTX_SL_RES_VLEN(sl)); chunk_memcat(chk, " ", 1); chunk_memcat(chk, HTX_SL_RES_CPTR(sl), HTX_SL_RES_CLEN(sl)); chunk_memcat(chk, " ", 1);