Why are major web sites using gzip?

最后都变了- 提交于 2019-11-30 06:53:21

问题


I just searched about gzip and Deflate, and found out that Deflate is better.

  • GZip or Deflate for HTTP compression
  • Why use deflate instead of gzip for text files served by Apache?
  • Is there any performance hit involved in choosing gzip over deflate for http compression?
  • Deflate compression browser compatibility and advantages over GZIP

But when I checked the response headers of Google, Facebook and StackExchange, all of them were using GZIP. Why do they use gzip instead of Deflate?


回答1:


It is apparently due to a misunderstanding resulting from the choice of the name "Deflate". The http standard clearly states that "deflate" really means the zlib format:

    The "zlib" format defined in RFC 1950 [31] in combination with
    the "deflate" compression mechanism described in RFC 1951 [29].

However early Microsoft servers would incorrectly deliver raw deflate for "Deflate" (i.e. just RFC 1951 data without the zlib RFC 1950 wrapper). This caused problems, browsers had to try it both ways, and in the end it was simply more reliable to only use gzip.

The impact in bandwidth and execution time to use gzip instead of "Deflate" (zlib), is relatively small. So there we are and there it is likely to remain.

The difference is 12 more bytes for gzip and slightly more CPU time to calculate a CRC instead of an Adler-32.



来源:https://stackoverflow.com/questions/9170338/why-are-major-web-sites-using-gzip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!