On 4/3/19 2:11 PM, Ludovic Courtès wrote:
What I do for the Kawa manual is generate an 'epub' archive, which is
basically a zip archive, with compression. It is fairly simple for a
web server to extract a zip member and send it to a browser directly
as a gzip-compressed file, without actually decompressing the file
(until it gets to the browser). I contributed support for this to
https://libwebsockets.org/, which is a compact C-language http server.
DomTerm uses this to "serve" the JavaScript files to the browser,
and a revamped 'info' program could do the same.
A simpler solution might be to use ‘Content-Encoding: gzip’.
That is what libwebsockets does given a zip archive (and a browser
that can handle Content-Encoding: gzip). There is a little bit of header
munging,
but it turns out the the compression used for a member of a zip archive is
exactly the same as used by ‘Content-Encoding: gzip’. So the web server can
extract the compressed data from the zip archive and send it directly to the
browser without having to decompress and then re-compress it.
DomTerm does the same for its JavaScript and css files: They're installed as a
zip archive, and the domterm command (using libwebsockets) starts up a browser
window
with a URL pointing back at itself. When files are requested it can send them
to the browser as ‘Content-Encoding: gzip’, without having to uncompress them
first.
--
--Per Bothner
[email protected] http://per.bothner.com/