Download raw body.
add support to httpd for serving static brotli encoded files
add support to httpd for serving static brotli encoded files
add support to httpd for serving static brotli encoded files
On Sat, 01 Aug 2026 12:30:05 +0200,
Stuart Henderson <stu@spacehopper.org> wrote:
>
> On 2026/08/01 11:41, Moviuro wrote:
> > On 26-02-25 09:46:36, Adam Mullins wrote:
> > >
> > > Here is another unified diff against -current. Compared to the first it:
> > > - Reorders SRVFLAG_BITS as suggested by Lloyd and adds an entry for
> > > brotli-static.
> > > - Edits comments, code, and whitespace to conform to style(9).
> > > - Removes some obvious comments and trims the length of the others.
> > > - Sorts variable declarations to conform; ie largest to smallest.
> > > - Renames the helper function from server_file_encoded_path() to
> > > find_compressed_path(). I wanted to avoid 'encoded' even though
> > > that is the name of the HTTP header because it could be confused for
> > > URL encoding. I also dropped the server_file prefix, following the
> > > lead of some other internal functions in server_file.c.
> >
> > Hi there,
> >
> > I suggest the following instead: overload gzip-static to handle all statically
> > compressed files that can be found on disk. Current state of the art is
> > gzip (~100%) + zstd (82.1%) + brotli (95.72%), so let's handle those [0].
> >
> > For all available encodings sent by the client, if they are supported by httpd,
> > pick the smallest available file that is also not older than the
> > source/original.
> >
> > Overloading gzip-static means that there's no new flag to manage in the config,
> > the current setups continue working, and changes are available immediately when
> > a supported compressed file is available on disk. When a new compression
> > algorithm (dcb, dcz) becomes available, we just add it to the struct - one-line
> > patches.
>
> Seems risky to add new extensions under an existing config. What happens
> if someone already has an unrelated file that gets picked up by this?
> Especially if adding more extensions later? Explicit config would make
> more sense.
>
Actually I had discussed that with rsadowski@ and I suggested an idea from
Nginx: to serve .gz (or other compressed files) only when mtime in source
and compressed are mathced.
Also, by default it should be disabled, and enabled like gzip-static but
with proper naming. Adding zstd-static and so on looks wrong, so I think
that we need to introduce supprot static-precompressed and the list of.
... and somewhere here I started to think that it is not that trivial, but
actually it can be interesting because brotli seems to save a lot in case of
large texts:
x $ libdeflate-gzip -f -k -12 index.html
x $ zstd --ultra -22 -f -k index.html
index.html : 27.91% ( 26.7 KiB => 7.45 KiB, index.html.zst)
x $ brotli -q 11 -f -k index.html
x $ xz -e -f -k index.html
x $ wc -c index.html*
27351 index.html
6174 index.html.br
7681 index.html.gz
7508 index.html.xz
7633 index.html.zst
56347 total
x $
--
wbr, Kirill
add support to httpd for serving static brotli encoded files
add support to httpd for serving static brotli encoded files
add support to httpd for serving static brotli encoded files