Don't mangle files that start with the gzip magic bytes. #1307
Comments
Thanks for your efforts! I have zipped the plugin folder and put it here: https://helloacm.com/data/gd-star-rating.zip |
A gzipped resource should start with the magic bytes
We should be aware of this, and avoid touching anything that starts with that. Maybe we should be like browsers and treat it as telling us that we're processing gzipped data if it then gunzips without errors, but we definitely shouldn't proceed as if it's text. |
Looking at the plugin, |
I'm not able to reproduce combining or mangling with gzipped data, just inlining it, so I'm going to send out a CL that just blocks the inlining. |
If what we're going to inline into CSS or JS starts with the gzip magic bytes (file signature) then it's very likely to be gzipped and very unlikely to be valid CSS or JS, so we should abort the inlining. Fixes the amount of #1307 that I could repro. If we later see mangling files in-place (or combining) then we can extend this.
Fixed by 703060b |
If what we're going to inline into CSS or JS starts with the gzip magic bytes (file signature) then it's very likely to be gzipped and very unlikely to be valid CSS or JS, so we should abort the inlining. Fixes the amount of #1307 that I could repro. If we later see mangling files in-place (or combining) then we can extend this.
From mod-pagespeed-discuss thread: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/mod-pagespeed-discuss/nehDfeYxlTQ/NKWKLLFPCAAJ
A site is using the GD Star Rating plugin, and the CSS for that plugin gets garbled by mod_pagespeed. I suspect this is because the plugin gzips its CSS output but does not give it content-encoding:gzip header. So mod_pagespeed attempts to parse the gzip output as plain CSS and reports lots of encoding warnings.
The output is also broken -- the CSS coming out of mod_pagespeed is not readable.
I think this is the fault of the plugin, but I can't prove it because the download link for the plugin is broken: http://www.gdstarrating.com/index.html . The customer is using GD Star 1.9.22.
As far as I can tell from that site, that whole gd-star system has not had an update in 5 years. However, the problem is avoided by telling mod_pagespeed not to touch it:
ModPagespeedDisallow */gdsr.css.php*
The text was updated successfully, but these errors were encountered: