Bug 53121

Summary: Confusing documentation, gzip and deflate
Product: Apache httpd-2 Reporter: Ryan4 <ryanchan404>
Component: DocumentationAssignee: HTTP Server Documentation List <docs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.2.22   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: mod_deflate doc patch
Amended explanation about gzip vs deflate

Description Ryan4 2012-04-22 05:30:54 UTC
The module is actually using gzip no matter what client request, so the documentation should warn at the top of documentation, state clearly that this module only output "gzip", no actual deflate is ever supported.

e.g.

Added in config: 

AddOutputFilterByType DEFLATE text/html text/plain text/xml


Test:

curl -I -H  'Accept-Encoding: gzip' http://www.example.com
Content-Encoding: gzip


curl -I -H  'Accept-Encoding: deflate' http://www.example.com
Content-Encoding: gzip


So, no actual deflate is ever supported.
Comment 1 Eric Covener 2012-04-22 11:29:19 UTC
some background:

http://www.gzip.org/zlib/zlib_faq.html#faq38

 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 specficiation 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.
Bottom line: use the gzip format for HTTP 1.1 encoding.
Comment 2 Wim Lewis 2014-03-25 21:42:27 UTC
Can confirm that mod_deflate in Apache 2.4 never uses the deflate encoding, only the gzip encoding.

(As Eric Covener says they use the same actual algorithm, also called "deflate", but the "gzip" and "deflate" content-encodings have slightly different headers.)
Comment 3 Luca Toscano 2015-12-28 14:08:14 UTC
Created attachment 33380 [details]
mod_deflate doc patch
Comment 4 Luca Toscano 2016-01-02 10:32:26 UTC
Created attachment 33393 [details]
Amended explanation about gzip vs deflate

After a chat with Humbedooh on #httpd-dev I revised my last patch with something more formal.
Comment 5 Luca Toscano 2016-01-02 10:35:12 UTC
Interesting note from Humbedooh: 

https://pony-poc.apache.org/thread.html/Zbw7u00bnri2c9k

The discussion about gzip vs deflate was done a while ago, it might be good to re-think about it since it is 2016 and super old browsers should not be a problem anymore.
Comment 6 Takashi Sato 2016-01-10 07:17:30 UTC
The patch is helpful. +1
Comment 7 Rich Bowen 2016-01-12 16:17:20 UTC
Thanks.

Applied to trunk in r1724273.
Applied to 2.4 in r1724274.