为什么现实世界的服务器更喜欢 gzip 而不是 deflate 编码?

发布于 2024-07-19 16:24:07 字数 406 浏览 10 评论 0原文

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

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

雅虎声称 deflate“效果较差”。 为什么?

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

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)?

Yahoo claims deflate is "less effective". Why?

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

拿命拼未来 2024-07-26 16:24:07

从我的最小测试来看,大多数 HTTPd 要么:

  1. 不支持即时 deflate:Apache 的 mod_deflate(令人惊讶),GWS
  2. 或者更喜欢发送 gzip:IIS、lighttpd 的 mod_compress

所以要在最流行的服务器上发送 deflate(Apache ),您必须维护预编码文件并使用 mod_negotiate (您甚至可能必须使用类型映射来首选 deflate)。

我猜想,由于这个麻烦,deflate 很少被使用,因此客户端 deflate 支持中比 gzip 支持中更可能存在错误。

From my minimal testing it appears most HTTPds either:

  1. don't support deflate on-the-fly: Apache's mod_deflate (a suprise), GWS
  2. or prefer to send gzip: IIS, lighttpd's mod_compress

So to send deflate on the most popular server (Apache), you must maintain pre-encoded files and use mod_negotiate (you might even have to use type-maps to prefer deflate).

I'd guess, due to this hassle, deflate is just rarely used, and therefore bugs are more likely to exist in client deflate support than in gzip support.

风吹雪碎 2024-07-26 16:24:07

查看此网站了解更多信息:
http://web.archive。 org/web/20120321182910/http://www.vervestudios.co/projects/compression-tests


Deflate,根据规范,实际上是 zlib(一种专门为通过网络传输内容而开发的压缩格式)...它是 deflate 的包装。

然而,Internet Explorer 错误地将 HTTP 1.1 deflate (zlib) 实现为原始 deflate。 因此,如果您的服务器向 IE 发送正确的 HTTP 1.1 deflate (zlib) 内容,它就会阻塞。

我对这个主题进行了一些研究,看起来总是将 raw deflate 发送到现代浏览器是安全的......只需确保它实际上是 raw 而不是 zlib 。

查看这篇文章了解更多信息>> 重新审视 Gzip 与 Deflate (zlib)

所以我认为有充分的理由继续通过 gzip 发送 deflate。

Check this website for more information:
http://web.archive.org/web/20120321182910/http://www.vervestudios.co/projects/compression-tests


Deflate, per spec, is actually zlib (a compression format developed specifically for streaming content over the web)...which is a wrapper around deflate.

Internet Explorer, however, incorrectly implements HTTP 1.1 deflate (zlib) as raw deflate. So if your server sends correct HTTP 1.1 deflate (zlib) content to IE it chokes.

I've researched the topic a bit and it looks safe to ALWAYS send raw deflate to modern browsers...just make sure its is, in fact, raw and not zlib.

Check this article for more information > Gzip vs Deflate (zlib) revisited.

So I think that there is a good reason TO continue sending deflate over gzip.

往日 2024-07-26 16:24:07

据我所知(免责声明:我不是这里的专家,只是我所听说的),gzip 使用与 deflate 相同的算法,但它有更多使其具有更大尺寸的标头内容(相对于 deflate)。 但是,我认为 deflate 受较少的客户端和代理支持。

As far as I know (disclaimer: and I'm not an expert here, just what I've heard), gzip uses the same algorithm as deflate but it has more header stuff that make it have a larger size (relative to deflate). However, I think deflate is supported by less clients and proxies.

溇涏 2024-07-26 16:24:07

我也想知道同样的事情:)。 我认为这可能与旧版(可能是古老的)浏览器的兼容性有关。 我在某处读到,较旧的浏览器更有可能在某些情况下看到 mod_gzip 压缩的压缩内容(?),但谷歌搜索这让我得出结论,最好停止谷歌搜索它。

I wondered the same thing :). I think it might be to do with compatibility of older (possibly ancient) browsers. I read somewhere that older browsers are more likely to creep out at deflated content that mod_gzipped in certain instances(?) but googling this led me to conclude that it's probably best to stop googling it.

一花一树开 2024-07-26 16:24:07

ActionScript 3 具有原生 deflate 支持,但对于 gzip,您需要使用外部库

ActionScript 3 has native deflate support, but for gzip you need to use an external library

死开点丶别碍眼 2024-07-26 16:24:07

之间的命名存在一些混淆

  • 规范与RFC 1951 是一种压缩数据格式
  • ZLIBRFC 1950 定义是一个使用DEFLATE数据格式的压缩数据格式。
  • GZIPRFC 1952 定义是使用DEFLATE压缩数据格式的文件格式。

但是 HTTP 使用不同的命名

  • gzip 由文件压缩程序“gzip”(GNU zip)生成的编码格式,如 RFC 1952 [25] 中所述。 此格式是具有 32 位 CRC 的 Lempel-Ziv 编码 (LZ77)。

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

总结一下:

  • gzipGZIP 文件格式。
  • deflate 实际上是ZLIB 数据格式。 (但有些客户端也接受 deflate 的实际 DEFLATE 数据格式。)

另请参阅此问题的答案“gzip”和“deflate”HTTP 1.1 编码之间有什么区别?

“gzip”和“deflate”HTTP 1.1 编码之间有什么区别?

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

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

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

But the HTTP uses a different naming:

  • 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 The "zlib" format defined in RFC 1950 [31] in combination with the "deflate" compression mechanism described in RFC 1951 [29].

So to sum up:

  • 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.)

See also this answer on the question What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?:

What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文