Home computickets How does Deflate differ from Gzip?

How does Deflate differ from Gzip?




Tell me what Deflate is different from GZIP? And is it possible to enable Gzip and Deflate compression simultaneously on the site? And do you need?

Answer 1, Authority 100%

Deflate – Algorithm of compression without loss. This algorithm is considered free from all existing patents and implemented in a multitude of Open-Source libraries. zlib is the most famous and used library, with the standard implementation of this algorithm. This library provides both the compression and unpacking functions and data format , called similarly – zlib .

ZLIB format is quite simple and consists of 3 parts:

  • Title (2 bytes 0x78 , 0x9c );
  • data compressed by the Deflate algorithm;
  • checksum (4 bytes, adler32 ) .

gzip – utility and Format data compression algorithm Deflate. GZIP format is somewhat more complicated:

  • header (10 bytes, first 2: 0x1f , 0x8b );
  • data compressed by the Deflate algorithm;
  • checksum (4 bytes, CRC32);
  • Uncompressed data size (4 bytes).

Next, when describing the title>Content-Encoding in HTTP 1.1, it was said that:

  • content-encoding: gzip – data in gzip format;
  • content-encoding: Deflate – data in zlib format .

And here the confusion and the early implementation of the web server Microsoft IIS to request the customer Accept-encoding: Deflate Data in raw data (RAW): Naked Deflate without any headers, and not zlib format (with heading and checksum). And browsers had to learn to guess, in what kind of format it was the data, ZLIB or Raw Deflate.

If it were not for this confusion, then most likely, Deflate (which zlib) would be preferable, because It has a smaller overhaul on the size of the headers (GZIP on 12 bytes more) and a faster algorithm of the checksum, but due to confusion, it is better to limit only GZIP format. Well, if you decide to enable and deflate, make sure your server gives data to Zlib format.

Why Are Major Web Sites Using Gzip? (Why are the main websites use gzip?).

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions