为什么主要网站都使用gzip? [英] Why are major web sites using gzip?

查看:95
本文介绍了为什么主要网站都使用gzip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚搜索了 gzip

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

但是当我检查Google,Facebook和StackExchange的响应标头时,它们都使用了GZIP.他们为什么使用gzip而不是Deflate?

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?

推荐答案

这显然是由于名称"Deflate"的选择引起的误解. http标准明确指出放气"实际上意味着zlib格式:

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].

但是,早期的Microsoft服务器会错误地为"Deflate"传递原始的deflate(即,仅带RFC 1951数据而没有zlib RFC 1950包装器).这导致了问题,浏览器不得不同时尝试两种方法,最后仅使用gzip更加可靠.

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.

使用gzip代替"Deflate"(zlib)对带宽和执行时间的影响相对较小.所以我们在那里,而且很可能会继续存在.

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.

区别是gzip多了12个字节,而计算出CRC而不是Adler-32的CPU时间略长.

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

这篇关于为什么主要网站都使用gzip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆