为什么现实世界的服务器更喜欢 gzip 而不是 deflate 编码? [英] Why do real-world servers prefer gzip over deflate encoding?

查看:17
本文介绍了为什么现实世界的服务器更喜欢 gzip 而不是 deflate 编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经知道 deflate 编码 在编码速度、解码速度和压缩大小方面优于 gzip.

We already know deflate encoding is a winner over gzip with respect to speed of encoding, decoding and compression size.

那么为什么没有大型网站(我可以找到)发送它(当我使用接受它的浏览器时)?

So why do no large sites (that I can find) send it (when I use a browser that accepts it)?

雅虎声称 deflate 效果较差".为什么?

Yahoo claims deflate is "less effective". Why?

我维护的 HTTP 服务器软件更喜欢 deflate,所以我想知道是否有一些非常好的理由不继续这样做.

I maintain HTTP server software that prefers deflate, so I'd like to know if there's some really good reason not to continue doing so.

推荐答案

规范和 HTTP 之间的命名存在一些混淆:

There is some confusion about the naming between the specifications and the HTTP:

  • DEFLATERFC 1951 定义是一个压缩数据格式.
  • ZLIBRFC 1950 定义是一个使用 DEFLATE 数据格式的压缩数据格式.
  • GZIPRFC 1952 定义是一个使用 DEFLATE 压缩数据格式的文件格式.
  • DEFLATE as defined by RFC 1951 is a compressed data format.
  • ZLIB as defined by RFC 1950 is a compressed data format that uses the DEFLATE data format.
  • GZIP as defined by RFC 1952 is a file format that uses the DEFLATE compressed data format.

但是 HTTP 使用不同的命名:

  • gzip 一种由文件压缩程序gzip"产生的编码格式.(GNU zip)如 RFC 1952 [25] 中所述.此格式是具有 32 位 CRC 的 Lempel-Ziv 编码 (LZ77).

  • gzip An encoding format produced by the file compression program "gzip" (GNU zip) as described in RFC 1952 [25]. This format is a Lempel-Ziv coding (LZ77) with a 32 bit CRC.

deflate zlib"RFC 1950[31]中定义的格式与deflate"相结合.RFC 1951 [29] 中描述的压缩机制.

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

总结一下:

  • gzipGZIP 文件格式.
  • deflate 其实就是ZLIB 的数据格式.(但有些客户端也接受 deflate 的实际 DEFLATE 数据格式.)
  • gzip is the GZIP file format.
  • deflate is actually the ZLIB data format. (But some clients do also accept the actual DEFLATE data format for deflate.)

另见这个问题的答案gzip"和gzip"之间有什么区别?和放气"HTTP 1.1 编码?:

gzip"和gzip"有什么区别?和放气"HTTP 1.1 编码?

gzip"是 gzip 格式,放气"是是 zlib 格式.他们可能应该将第二个称为zlib".而是避免与原始 deflate 压缩数据格式混淆.虽然 HTTP 1.1 RFC 2616 正确地指向了 RFC 1950 中的 zlib 规范,用于放气"传输编码,有报告称服务器和浏览器根据 RFC 1951 中的 deflate 规范错误地生成或期望原始 deflate 数据,最著名的是 Microsoft.所以即使放气"使用 zlib 格式传输编码将是更有效的方法(实际上正是 zlib 格式的设计目的),使用gzip"由于 HTTP 1.1 作者不幸选择了名称,传输编码可能更可靠.

"gzip" is the gzip format, and "deflate" is the zlib format. They should probably have called the second one "zlib" instead to avoid confusion with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 correctly points to the zlib specification in RFC 1950 for the "deflate" transfer encoding, there have been reports of servers and browsers that incorrectly produce or expect raw deflate data per the deflate specification in RFC 1951, most notably Microsoft. So even though the "deflate" transfer encoding using the zlib format would be the more efficient approach (and in fact exactly what the zlib format was designed for), using the "gzip" transfer encoding is probably more reliable due to an unfortunate choice of name on the part of the HTTP 1.1 authors.

这篇关于为什么现实世界的服务器更喜欢 gzip 而不是 deflate 编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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