Bug 58158

Summary: Not honoring HTTP spec with regard to Accept-Encoding
Product: Apache httpd-2 Reporter: shazim
Component: mod_deflateAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: major Keywords: FixedInTrunk
Priority: P2    
Version: 2.4.41   
Target Milestone: ---   
Hardware: Other   
OS: Linux   

Description shazim 2015-07-21 00:41:43 UTC
RFC1616 explains that multiple content-coding preferences can be set via Accept-Encoding, and it is possible to specify encoding that is not acceptable as well as acceptable.

For example, the following request is a request for plain uncompressed response (identity) and that gzip encoding is not acceptable, yet the response will be compressed by mod_deflate.

curl -X GET "" -v -H "Accept-Encoding: identity;q=1,gzip;q=0"

> GET /test.html HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/ Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host:
> Accept: */*
> Accept-Encoding: identity;q=1,gzip;q=0
< HTTP/1.1 200 OK
< Date: Tue, 21 Jul 2015 00:38:58 GMT
< Server: Apache/2.2.15 (CentOS)
< Last-Modified: Mon, 20 Jul 2015 21:45:50 GMT
< ETag: "4731-8-51b557614d221"
< Accept-Ranges: bytes
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Content-Length: 28
< Connection: close
< Content-Type: text/html; charset=UTF-8

RFC 14.3 explains further http://www.w3.org/Protocols/rfc2616/rfc2616.txt
Comment 1 William A. Rowe Jr. 2018-11-07 21:09:12 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.
Comment 2 Erwan Legrand 2019-10-08 13:54:46 UTC
This erroneous behaviour is still exhibited by the last Apache HTTPD release. As a result mod_deflate sends gzipped data to clients which do not support gzip.
Comment 3 Christophe JAILLET 2019-10-10 20:46:35 UTC

Patch and updated test framework to follow in the coming days.

mod_brottl, also have the same issue, where q=0 is not handled.
Comment 4 Christophe JAILLET 2019-10-11 19:20:55 UTC
Tests added in r1868312.
Comment 5 Christophe JAILLET 2019-10-11 20:22:48 UTC
Fixed in trunk in r1868313.

If you could confirm the fix, it would be great.
Comment 6 Christophe JAILLET 2021-09-26 16:32:53 UTC
Backported in 2.4.x in r1869502.

This is part of 2.4.42