[OpenWrt-Devel] Fwd: [PATCH] uhttpd: serve precompressed files

Bastian Bittorf bittorf at bluebottle.com
Mon Sep 7 09:45:45 EDT 2015

* Adrian Kotelba <adrian.kotelba at gmail.com> [07.09.2015 15:18]:
> > ok, as far as i understand the patch, if somebody
> > tries to http_get file 'xy.html' and the webserver
> > finds 'xy.html.gz' it serves this file, right?
> Right. More preciselly, if somebody tries to http_get file 'xy.html'
> and the webserver does find it, then it serves it.
> If 'xy.html' is not found, then webserver tries 'xy.html.gz'. If
> 'xy.html.gz' is found, then it is served.

ok, what you can do is this:

check if HTTP_ACCEPT_ENCODING has some of
gzip, deflate, sdch or whatever you think makes sense
and live-compress if enabled via uci and it _is_ a
static file. (i think the cgi-case is more complicated)
also take care of the headers, you must set something like:

'Content-Encoding: gzip'

unsure what to do with 'content length' because you
only know this after compression, but you should do it

bye, bastian
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list