]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: hpack: fix encoding of "accept-ranges" field
authorWilly Tarreau <w@1wt.eu>
Tue, 20 Nov 2018 03:47:38 +0000 (04:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Nov 2018 03:47:38 +0000 (04:47 +0100)
James Brown reported that when an "accept-ranges" header field is sent
through haproxy and converted from HTTP/1.1 to H2, it's mis-encoded as
"accept-language". It happens that it's one of the few very common header
fields encoded using its index value and that this index value was misread
in the spec as 17 instead of 18, resulting in the wrong name being sent.
Thanks to Lukas for spotting the issue in the HPACK encoder itself.

This fix must be backported to 1.8.

src/hpack-enc.c

index 70d2b12f65a9506f3e5f4ff3ff68aaaa1056fd49..2bb00507173041f988c1185d01658e67a6356a3f 100644 (file)
@@ -102,7 +102,7 @@ int hpack_encode_header(struct buffer *out, const struct ist n,
        else if (isteq(n, ist("last-modified")))
                out->area[len++] = 0x6c; // literal with indexing -- name="last-modified" (idx 44)
        else if (isteq(n, ist("accept-ranges")))
-               out->area[len++] = 0x51; // literal with indexing -- name="accept-ranges" (idx 17)
+               out->area[len++] = 0x52; // literal with indexing -- name="accept-ranges" (idx 18)
        else if (isteq(n, ist("cache-control")))
                out->area[len++] = 0x58; // literal with indexing -- name="cache-control" (idx 24)
        else if (isteq(n, ist("content-length")))