Changes to thttpd

thttpd homepage

Files

Not currently maintained!

None of the patches on this page are maintained. Feel free to use them, fix them, or extend them. Please let me know about any work you do on these patches, or where the work is available.

Latest work

patch for version 2.25b: Not thoroughly tested... To install: unpack thttpd, patch, run configure, make, make install

My 2.25b-re1 patch has these features:

2.23 changelog for my patches

Changes to thttpd-2.23beta1 Compression patch (aka "Content-encoding patch"): patch

Shell script for creating compressed files

Here is a shell script (updated July, 2003) that compresses everything in your directory tree that has an extension indicating that it's a text file. It saves the original and creates another file that is compressed. It will update the compressed file if the original has a later timestamp. This would be useful to have as a cron job. (This was designed for "send previously encoded" documents)

Gory details of content-encoding work:

The client capabilities for compression are determined from the "accept-encoding" header, and if "gzip" is supported, a flag is set. When the validity of the document is checked (exists, is world readable, etc), the following sequence occurs: if a file exists with ".gz" appended to the end, is world readable, and has date/time later than the original file, the .gz file will be sent instead of the original. When the headers are composed for the response, if dynamic compression is going to occur (client supports "gzip" encoding, .gz file doesn't exist or time/date mismatch, and mime type starts with "text/"), add "Content-encoding: gzip" to headers. (That header is added automatically for files that are sent whose names end with ".gz".)

When preparing file to send, if it is to be dynamically compressed, initialize zlib functions, and set the output data pointer to the zlib output buffer instead of the mmap()'ed memory. Each time we are to send the file, call the deflate function in zlib with the "finalize" flag to indicate to compress as much as possible into the output buffer, and send it. When we're done compressing, add the zlib footer and close the zlib functions.

Suggestions:

To obtain the best compression, use lowercase HTML tags. A test was done by the W3C with different combinations of upper and lowercase tags, and the best compression was seen with lowercase tags. See this link.

Clean up your Web pages with HTML TIDY. See http://tidy.sourceforge.net.

Older patches

Older patches to thttpd-2.21b and thttpd-2.22 aren't really maintained anymore. Feel free to play with them anyway.

Files

2.22 changelog for my patches

2.21b changelog for my patches

Email me!

This page last changed Jan 4, 2006