]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-h2: make use of hpack_encode_scheme() to encode the scheme
authorWilly Tarreau <w@1wt.eu>
Mon, 10 Dec 2018 18:17:06 +0000 (19:17 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Dec 2018 08:07:02 +0000 (09:07 +0100)
The HTTP scheme encoding was open-coded with a HPACK byte matching the
"https" scheme. Let's make use of the new functions to avoid this.

src/mux_h2.c

index 4eebe1a04c1d9aa51cc9e2134b4b9abe749e9dae..80a6fe0c2c69646e77bf1a91b835a4142cb99e7b 100644 (file)
@@ -4069,8 +4069,12 @@ static size_t h2s_htx_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
        }
 
        /* encode the scheme which is always "https" (or 0x86 for "http") */
-       if (outbuf.data < outbuf.size)
-               outbuf.area[outbuf.data++] = 0x87; // indexed field : idx[02]=(":scheme", "https")
+       if (!hpack_encode_scheme(&outbuf, ist("https"))) {
+               /* output full */
+               if (b_space_wraps(&h2c->mbuf))
+                       goto realign_again;
+               goto full;
+       }
 
        /* encode the path, which necessarily is the second one */
        if (outbuf.data < outbuf.size && isteq(path, ist("/"))) {