UPDATE Feb 10 2012:
zOompf has completed some very thorough research on this very topic here. It trumps any findings below.
UPDATE Sept 11 2010:
A testing platform has been created for this here
HTTP 1.1 definitions of GZIP and DEFLATE (zlib) for some background information:
” ‘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 products. 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.” (source: http://www.gzip.org/zlib/zlib_faq.html)
So, my question: if I send RAW deflate data with NO zlib wrapper (or gzip,
for that matter) are there any modern browsers (e.g., IE6 and up, FF,
Chrome, Safari, etc) that can NOT understand the raw deflate
compressed data (assuming HTTP request header “Accept-Encoding” contains “deflate”)?
Deflate data will ALWAYS be a few bytes smaller than GZIP.
If all these browsers can successfully decode the data, what
downsides are there to sending RAW deflate instead of zlib?
UPDATE: Browsers have been dropping support for raw deflate. zOompf has completed some very thorough research on this very topic here. Unfortunately, it appears that raw deflate is NOT safe to use.
Check http://www.vervestudios.co/projects/compression-tests/results for more results.Here are the browsers that have been tested:
* Android Sends HTTP request header “Accept-Encoding: gzip”. Deflate is not permitted.
I conclude that we can always send raw DEFLATE (when the HTTP request header “Accept-Encoding” contains “deflate”) and the browser will be able to correctly interpret the encoded data. Can someone prove this wrong?
note: .NET’s native implementation of DEFLATE (System.IO.Compression.DeflateStream) is raw DEFLATE. It also sucks. Please use zlib.net for all of your .NET deflating needs.