lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Rici Lake wrote:
On 14-Mar-05, at 2:06 PM, PA wrote:

local zlib = require( "zlib" )
local aCompressedContent = zlib.compress( aContent )
"gzip stream does not have a gzip header"
What am I doing wrong? Do I need to provide additional parameters to zlib.compress()?

You need to format the stream by sending a gzip header prior to the compressed content. (You will also need to provide a trailer containing a CRC.) It's annoying, isn't it? And really badly documented. Most of the implementations I've seen are cargo culted from other implementations.

You might find this page a useful place to start. It's not the best, but I only googled for three minutes:

Just look for these, they are quite readable:
RFC 1950 ZLIB Compressed Data Format Specification version 3
RFC 1951 DEFLATE Compressed Data Format Specification ver 1.3
RFC 1952 GZIP File Format Specification version 4_3

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia