]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: htx: Force HTTP/1.1 on H1 formatting when version is 1.1 or above
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 3 Dec 2018 13:05:01 +0000 (14:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 4 Dec 2018 04:51:39 +0000 (05:51 +0100)
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.

src/htx.c

index d5285eb6d0a88bdb2423b10ed6dbcd34a4b560d2..0d7ddc1538efe11d86f7120c6e58786837e1ed54 100644 (file)
--- 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);