GZip, deflate and SDCH compression (NET pick-up)

Source: Internet
Author: User

Gzip and Deflate:

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.

Deflate is the most basic algorithm, Gzip added 10 bytes of Gzheader in front of deflate raw data, the tail adds 8 bytes of check bytes (optional CRC32 and ADLER32) and length identification bytes.

SDCH:

We know that in order to speed up the transmission of the network, the text is generally compressed using gzip. If you are now using the latest version of Chrome to access the page, then open the Network Control Panel to view the HTTP headers, carefully you will find in the request headers accept-encoding is no longer gzip,deflate, But more a sdch, became GZIP,DEFLATE,SDCH.

What the hell is SDCH?

SDCH is the acronym for Shared Dictionary Compression over HTTP, which compresses the same content in each page through a dictionary compression algorithm, reducing the transmission of the same content. such as: A site is generally common head and tail, and even some sidebar is common. Before the way each page opens, these common information will be reloaded, but using SDCH compression, those common content is only transmitted once.

SDCH is divided into 3 main parts: first request, download dictionary, and then request.

This is the first time that the Google Toolbar is ready for IE, Chrome has been fully supported, but has not yet discovered which website is in use.

SDCH and Ajax+pushstate

The Sdch compression method is to reduce the transmission of the same content, while the previously described ajax+pushstate is also to reduce the same content of the transmission, they want to achieve the same effect. Just Sdch is Google out, may be in the future only Chrome browser support, but Pushstate is a standard for HTML5, now has Chrome and Firefox support, then there will be more and more browser support.

Personally, SDCH may not have much development, but it can be studied as a new direction and added to the standard at the right time, making the network more and more rapid.

GZip, deflate and SDCH compression (NET pick-up)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.