Gzip is a data format that, by default, compresses the data section using only the DEFLATE algorithm;
Deflate is a compression algorithm, which is a kind of enhancement of Huffman coding.
Deflate is almost identical to the code that gzip extracts, and you can synthesize a piece of code.
The difference is only:
Deflate uses Inflateinit (), while Gzip initializes with InflateInit2 (), one more parameter than Inflateinit ():-max_wbits, which represents processing raw deflate data. Because the zlib compressed data block in the GZIP data does not have a zlib header of two bytes. The Zlib library is required to ignore the zlib header when using InflateInit2. In the Zlib manual, Windowbits is required to be 8. 15, but in fact other ranges of data have a special effect, see Zlib.h in the comments, such as negative numbers indicate raw deflate.
Apache's deflate variant may also have no zlib header, which requires the addition of a dummy header after processing.
That is, MS Error deflate (raw deflate). zlib header 1th Byte is generally 0x78, the 2nd byte and the first byte should be divisible by 31, see rfc1950. For example, Firefox's zlib dummy head for 0x7801,python zlib.compress () results in head 0x789c.
The difference between gzip and deflate compression