Steps to reproduce:
1. Clear your cache in admin > performance
2. wget --header="accept-encoding: gzip" http://your-drupal-website/page
3. Observe that the file is not a binary gzip
4. Do it again (wget....)
3. Observe that the new file *is* a binary gzip

This is more of a design problem:

In line 573 of bootstrap.inc, latest D6 you notice that ob_start() is called if cache is empty.

In 1620 of common.inc, the cache is finally set, for the next time -- because for this particular render, the ob_start takes care of things.

Current stop-gap solution:

Change line 573 of bootstrap.inc to ob_start("ob_gzhandler"); which assumes you have zlib installed and working.

Comments

pwolanin’s picture

Version: 6.16 » 6.x-dev

Not sure if this is still an issue in 7.x or not.

From the PHP docs: http://www.php.net/manual/en/function.ob-gzhandler.php

"note that using zlib.output_compression is preferred over ob_gzhandler()."

pwolanin’s picture

In page_set_cache() you could probably call ob_get_flush() and then print the compressed data instead of calling ob_end_flush();

arnabdotorg’s picture

This issue relates to the overall problem mentioned here.

mikeytown2’s picture

I do know that in pressflow, it will send out gzip on uncached requests

Mr Bearly’s picture

I have been trying to add gzip compression to my website to speed up the page loads. I started to go through the process of adding the ob_start("ob_gzhandler") to all the pages but it didn't seem to have any effect on the core ones I did. I tried putting it in the bootstrap section of Drupal Tweaks with no effect. Setting up in the .htaccess file looked like an option as did the php.ini file but I tried one other thing first. I replaced line 574 in the bootstrap.inc file with

if(!ob_start("ob_gzhandler")) ob_start();

and tested it at http://www.whatsmyip.org/http_compression/ , after clearing the cache, with these results

http://www.bearlybooks.com/ is gzipped

Original Size: 32.76 KB
Gzipped Size: 7.62 KB
Data Savings: 76.74%

From these results you can see that gzip does work for non-cached pages. Probably not relevant but I'm using Analytic as the theme and the Drupal Version is 6.16

Thought this might help som other Drupalier.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.