getpelican/pelican-plugins — pull request #243 by erfaan (2014-07-23 09:43:59+00:00)
Title: Fixed: Gzip header should not contain filename. This causes error with some clients.

Checking the gzipped output with redbot.org produces following error:

> GZip-compressed responses use zlib compression to reduce the number of bytes transferred on the wire. However, this response could not be decompressed; the error encountered was "Error -3 while decompressing: invalid stored block lengths".
>
> 0 bytes were decompressed successfully before this; the erroneous chunk starts with "index.html\x00\xbd}\xdbv\xdb\xb8\x92\xe8".

As we can see that the `filename` in header are causing problems.

According to [zlib manual](http://www.zlib.net/manual.html):

> Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to 255 (unknown)

So, the solution is to use simple gzip header (and trailer) instead of zlib wrapper (which includes filename in header). This is only possible using the underlying [zlib](https://docs.python.org/2/library/zlib.html) library of [gzip](https://docs.python.org/2/library/gzip.html).

This fix not only removed the `filename` from headers but also sets `mtime` to zero which was being set to zero manually.