为什么各大网站都使用 gzip?
我刚刚搜索了 gzip 和 Deflate,发现Deflate更好。
- 用于 HTTP 压缩的 GZip 或 Deflate
- 为什么对由 apache 提供的文本文件使用 deflate 而不是 gzip Apache?
- 选择 gzip 而不是 deflate 进行 http 压缩是否会对性能造成影响?
- Deflate 压缩浏览器兼容性和相对于 GZIP 的优势
但是当我检查响应时Google、Facebook 和 StackExchange 的标头都使用 GZIP。为什么他们使用 gzip 而不是 Deflate?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这显然是由于选择“Deflate”这个名字而引起的误解。 http 标准明确指出“deflate”实际上意味着 zlib 格式:
然而,早期的 Microsoft 服务器会错误地为“Deflate”提供原始 deflate(即,仅 RFC 1951 数据,而没有 zlib RFC 1950 包装器)。这导致了问题,浏览器必须两种方式都尝试,最终只使用 gzip 更可靠。
使用 gzip 代替“Deflate”(zlib) 对带宽和执行时间的影响相对较小。所以我们现在就这样,而且很可能会继续下去。
区别在于 gzip 多了 12 个字节,计算 CRC(而不是 Adler-32)的 CPU 时间也稍长一些。
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:
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.