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

src/mux_h2.c

index 80a6fe0c2c69646e77bf1a91b835a4142cb99e7b..15fd304cf1242e869c939e37f7b590479121f7f3 100644 (file)
@@ -4077,13 +4077,7 @@ static size_t h2s_htx_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
        }
 
        /* encode the path, which necessarily is the second one */
-       if (outbuf.data < outbuf.size && isteq(path, ist("/"))) {
-               outbuf.area[outbuf.data++] = 0x84; // indexed field : idx[04]=(":path", "/")
-       }
-       else if (outbuf.data < outbuf.size && isteq(path, ist("/index.html"))) {
-               outbuf.area[outbuf.data++] = 0x85; // indexed field : idx[04]=(":path", "/index.html")
-       }
-       else if (!hpack_encode_header(&outbuf, ist(":path"), path)) {
+       if (!hpack_encode_path(&outbuf, path)) {
                /* output full */
                if (b_space_wraps(&h2c->mbuf))
                        goto realign_again;