> I have a C module started that uses the gzip compression routine, but:
>
> A) it's not returning the right stuff; the buffer compression routines
> do not return a complete gzip file, which is what is expected by the
> browser
I didn't look at your module, but I have used zlib to send gzip-format
data on HTTP connections in another web server.
To send a gzip-format file, you send a 10 byte header:
#define GZIP_FILE_HEADER \
"\037\213" /* GZIP magic number */ \
"\010" /* Z_DEFLATED */ \
"\000" /* flags */ \
"\000\000\000\000" /* timestamp */ \
"\000" /* xflags */ \
"\003" /* Unix OS_CODE */
Then you send the deflated data. You also need to compute a CRC-32 of
the uncompressed data. (You can use the crc32 function in zlib.) After
sending all of the deflated data, you send the CRC-32, and then the
32-bit length of the uncompressed data. You must send the two 32-bit
numbers in LSB-first (little endian) format.
The gzip file format is fully documented in RFC 1952:
<ftp://ftp.isi.edu/in-notes/rfc1952.txt>
> B) it crashed the server a few times; not sure if the gzip library
> is thread-safe, etc.
I suspect that you have a bug or two. The zlib README says it's
thread-safe, and the library has been out for a long time and is very
widely used.