]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-h2: pass trailers to H1 (legacy mode)
authorWilly Tarreau <w@1wt.eu>
Thu, 3 Jan 2019 15:18:34 +0000 (16:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 3 Jan 2019 17:45:38 +0000 (18:45 +0100)
When forwarding an H2 request to an H1 server, if the request doesn't
have a content-length header field, it is chunked. In this case it is
possible to send trailers to the server, which is what this patch does.
If the transfer is performed without chunking, then the trailers are
silently discarded.

src/mux_h2.c

index 9f0b89dbc9591a78713a7f9fd7fb8c5910476ccd..74c6c0a2e0e492653652db7092a6c21872237927 100644 (file)
@@ -3469,7 +3469,12 @@ next_frame:
                 * data block message emit the trailing CRLF */
                if (!b_putblk(rxbuf, "0\r\n", 3))
                        goto fail;
-               /* FIXME: emit the decoded trailers here */
+
+               outlen = h2_make_h1_trailers(list, b_tail(rxbuf), try);
+               if (outlen > 0)
+                       b_add(rxbuf, outlen);
+               else
+                       goto fail;
        }
 
        goto done;