#3586·h2o

Headers and Brotli

Author: lgg2Created May 5, 2026Updated May 5, 2026

Hello,

Using the latest git (but also with previous), I am having issues with listing the request headers.

If I place in the path request handler this code..

c
printf("%d headers:\n", req->headers.capacity);
for (int i = 0; i < req->headers.capacity; ++i)
{
    printf("\t%.*s => %.*s\n", req->headers.entries[i].name->len, req->headers.entries[i].name->base,
			   req->headers.entries[i].value.len, req->headers.entries[i].value.base);
}

.. I get a "segment fault" at index last position (aka. i < req->headers.capacity) when I make a request using curl -v -H "Accept-Encoding: br" http://localhost:8081, giving only 3 entries of 4. "Host:" entry (the first?) doesn't get out.

SORRY: solved with the use of req->headers.size instead.

This also comes with the second problem. If I try to use only "brotli" (It is instaled in the system [Linux]), I configure the "libh2o" in the code with..

c
h2o_compress_args_t compress_args = {.brotli.quality = 4, .gzip.quality = -1, .min_size = 0};
h2o_compress_register(path_configuration, &compress_args);

..forcing to use "brotli", but nothing happens. But If I do the same with "gzip", the test goes ok. And If configure both (i.e.: quality=5 on both) the client only report the "gzip" compression.

Any tip? Something wrong with this steps? Thanks.