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 d5285eb..0d7ddc1 100644
--- a/src/htx.c
+++ b/src/htx.c
@@ -814,7 +814,11 @@
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 @@
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);