Posted by arnabdotorg on April 12, 2010 at 3:10am
4 followers
Jump to:
| Project: | Drupal core |
| Version: | 6.x-dev |
| Component: | base system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
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
#1
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()."
#2
In page_set_cache() you could probably call ob_get_flush() and then print the compressed data instead of calling ob_end_flush();
#3
This issue relates to the overall problem mentioned here.
#4
I do know that in pressflow, it will send out gzip on uncached requests
#5
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.