Bug in supporting Quality zero (negate) parameter in Accept-Encoding

rburkat nginx-forum at nginx.us
Wed Aug 3 18:17:15 UTC 2011


Hi Igor, thanks for the quick patch.   This patch is different than the
nginx-1.1.0 code.  I assume the 1.1.0 code supersedes the patch as it
was posted later. If not, disregard.

The nginx-1.1.0 code has a bug in it.  ( from a glance the patch would
have been ok )

nginx-1.1.0 does not handle the case for  "gzip;q=1.0" correctly.  It
should compress and it does not.

I see that the code is exhaustive in it's validation of the 0.??? case,
but does not work for 1.0 1.00 1.000.  ( just "1" is ok )  

My quick hack to correct this was..

- if (p == last || *p == ',' || *p == ' ' ) {
+ if (p == last || *p == ',' || *p == ' ' || *p == '.') {


I took a quick log this morning from a production box of the most
frequent accept-encoding requests and the gzip;q=1.0 case is common.
In order of descending frequency...

Accept-Encoding: gzip, deflate
Accept-Encoding: gzip,deflate,sdch
Accept-Encoding: gzip,deflate
Accept-Encoding: gzip
Accept-Encoding: gzip, x-gzip
Accept-Encoding:
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Accept-Encoding: identity
Accept-Encoding: gzip;q=1.0, deflate;q=0.8, chunked;q=0.6,
identity;q=0.4, *;q=0
Accept-Encoding: deflate, gzip
Accept-Encoding: x-gzip, gzip, deflate
Accept-Encoding: identity,gzip,deflate
Accept-Encoding: gzip, deflate, x-gzip, identity; q=0.9  
Accept-Encoding: gzip;q=1.0, deflate;q=0.8, chunked;q=0.6
Accept-Encoding: identity; q=1
....

Radek

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,213108,213335#msg-213335



More information about the nginx mailing list