bzip2 和 x-bzip2 有什么区别

What is the difference between bzip2 and x-bzip2

在 HTTP 响应中,Content-Encoding header 字段可以是 bzip2 或 x-bzip2

例如,您可能会得到类似

的内容
HTTP/1.1 200 OK
Date: mon, 9 Mar 2016 22:38:34 GMT
...
Content-Encoding: bzip

或类似

HTTP/1.1 200 OK
Date: mon, 9 Mar 2016 22:38:34 GMT
...
Content-Encoding: x-bzip

它们有什么区别?

看来区别只是 "bzip2" 是实际格式,而 "application/x-bzip2" 是 MIME 类型。换句话说,它是 poh-tay-toh / poh-tah-toh -- 它们是同一回事。

wikipedia link to bzip2

wikipedia link to archive formats

真的有none。正如您在 IANA Content Coding Registry, bzip2 and x-bzip2 are no registered content codings. The preceding x- has been meant to stress out the unregistered nature of this coding (see also x-gzip vs. gzip). Interestingly, this pre-dates even RFC1945. RFC1521, section 5 状态中看到的那样:

Implementors may, if necessary, define new Content-Transfer-Encoding values, but must use an x-token, which is a name prefixed by "X-" to indicate its non-standard status, e.g., "Content-Transfer-Encoding: x-my-new-encoding".

就支持而言:据我所知,Lighttpd 是唯一支持 bzip2 的网络服务器。我确信 elinks 理解 bzip2 的内容,但应该还有其他内容。

很少看到实际使用这种编码,因为 bzip2 相当 CPU-heavy 而 gzip 在速度和压缩率之间提供了更好的折衷。