Improperly compressed CSS?

slacy

Joined: 2004-12-17
Posts: 21
Posted: Fri, 2009-07-17 23:59

Hi, just upgraded my empty gallery from G3B1 to G3B2, and now I'm seeing CSS-less output

Example: http://kleinlacy.com/gallery3

G3B1 worked fine in this respect. Looking at the CSS and JS requests via firebug (index.php/combined/css/...) I'm seeing either empty output if zlib.output_compression = Off, or garbled (compressed CSS) if zlib.output_compression = On.

My gallery3/local.php contains:

<?
define('IN_PRODUCTION', false);
error_reporting(E_ALL);
ini_set('display_errors', true);
?>

And my gallery3/var/logs directory is empty.

Halp!

 
slacy

Joined: 2004-12-17
Posts: 21
Posted: Sat, 2009-07-18 00:04

By the way, I've tried running the garbled CSS through commandline gzip, and it doesn't work, so I'm actually not sure what that data is. I had assumed that it was double-gzipped.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2009-07-18 00:05

Works for me. Clear your browser cache or try a different browser.

FF 3.5 has your site showing up just fine.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
slacy

Joined: 2004-12-17
Posts: 21
Posted: Sat, 2009-07-18 00:10

I've done a shift-reload several times, and always get the same effect. I've just tried it on FF3.5 on a computer that's never visited that site, and am still not loading properly.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2009-07-18 00:14

Are you behind any sort of proxy server? Really, I can't reproduce it here. It even loads in IE 6, looks ugly, but that's IE6's fault for not being able to handle PNGs and other css stuff, but the CSS is there for me.

This is the link to the CSS file that I'm being served:
http://kleinlacy.com/gallery3/index.php/combined/css/eafb12a2f42cc13c43dc0791348d1ae1.css
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
slacy

Joined: 2004-12-17
Posts: 21
Posted: Sat, 2009-07-18 00:25

Here are my request and response headers. Of interest is "Accept-Encoding" and "Content-Encoding":

Request:

Host: kleinlacy.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.10) Gecko/2009042513 Ubuntu/8.04 (hardy) Firefox/3.0.10
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://kleinlacy.com/gallery3/
Cookie: g3sid=b05c582542369de32225c67290c4cd69
Pragma: no-cache

Response:

Date: Sat, 18 Jul 2009 00:22:17 GMT
Server: Apache/2.2.8 (Ubuntu) mod_fastcgi/2.4.6 mod_python/3.3.1 Python/2.5.2 PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_wsgi/1.3
X-Powered-By: PHP/5.2.4-2ubuntu5.6
Expires: Tue, 19 Jan 2038 00:00:00 GMT
Cache-Control: max-age=2678400
Pragma: public
Set-Cookie: g3sid=b05c582542369de32225c67290c4cd69; expires=Sat, 25-Jul-2009 00:22:17 GMT; path=/; httponly
Content-Encoding: gzip
Last-Modified: Sat, 18 Jul 2009 00:22:17 GMT
Vary: Accept-Encoding
Keep-Alive: timeout=15, max=91
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/css; charset=UTF-8

 
slacy

Joined: 2004-12-17
Posts: 21
Posted: Sat, 2009-07-18 01:08

So, yeah, I can repro this via curl by looking at:

$ curl -H "Accept-Encoding: gzip" http://kleinlacy.com/gallery3/index.php/combined/css/eafb12a2f42cc13c43dc0791348d1ae1.css -O /tmp/test.css.gz
$ file /tmp/test.css.gz
/tmp/test.css.gz: gzip compressed data, from Unix
$ gunzip /tmp/test.css.gz
$ head -3 /tmp/test.css
�}{s㶓����fj^.I���욽��#���c�����n�E��Ę"���qy?�5�ē�3��S���ht7���ʳ���.;�p����,������$u�����ߕ��*[��*y�FQt�C���e�O�S���<G4�FMu����'��q�vE�+Ԭ1���=�̒��M�=;>N�5��-���%������5��,��h0

(In other words, garbage)

If you leave out the -H parameter to curl, then you get the non-compressed data properly.

If you add -H to curl and fetch some other URL, then you can properly gunzip the resultant file.

My Firefox instance always passes "Accept-Encoding: gzip,deflate" as noted above, so it gets the corrupted data every time for CSS. But, for some reason, this only affects the .css and .js output. HTML seems ok. I'd suspect some bad code in the handler for index.php/combined/*, but I haven't looked at the code yet.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2009-07-18 01:58

Did some more testing.

If I turn on zlib compression on my server, and restart the webserver, then I get the same thing. The problem is the same thing as in G2. You can't have zlib compression on on the server, the file is already getting compressed by Gallery.

Try turning zlib off again and making sure you restart the webserver.

Take a look at /gallery3/modules/gallery/libraries/Gallery_View.php

That's where they get combined and gzipped

If you're still having issues, post a link to phpinfo.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2009-07-18 03:59

Hi, Steve! Good catch.. I recorded this as ticket http://sourceforge.net/apps/trac/gallery/ticket/555 and fixed it by sending back the uncompressed version if you're using PHP's zlib. Try again with the latest code.

---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2009-07-18 03:59

Bharat's one bad mo-fo :)

He's applied a fix for this: http://github.com/gallery/gallery3/commit/e7c6861507ea7ca01d3d4ed7b4189c030c8d07b3

Try grabbing the latest code and see if that works. I'll try on my server now.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
slacy

Joined: 2004-12-17
Posts: 21
Posted: Sat, 2009-07-18 04:02

I'm fairly certain this problem doesn't exist in G2. I've had a g2 instance on that same machine (same apache instance, same php.ini) running on http://kleinlacy.com/gallery and it works just fine (CSS & HTML).

The other thing that makes me think it's not a server configuration issue is that it can serve the HTML just fine with Content-Encoding: gzip, but the CSS & JS (which come through the combiner script, don't work.

 
slacy

Joined: 2004-12-17
Posts: 21
Posted: Sat, 2009-07-18 04:04

Wow, just saw Bharat's update. git pull has solved it all. Now, it's on to trying to import 30,459 photos from g2 to g3. :)

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2009-07-18 04:10

cya in about 4 or 5 days :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here