gzip support based on
https://github.com/ymnk/jzlib