|
On 14-Mar-05, at 2:06 PM, PA wrote:
local zlib = require( "zlib" ) local aCompressedContent = zlib.compress( aContent ) http://dev.alt.textdrive.com/file/LW/LWResponse.luaHowever, when a browser tries to decode such response, I get the following exception:"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: http://www.cherrypy.org/wiki/NotesOnTicket59