Hi,

I'm in a situation where I need the ability to flush the output of my CGI 
script to the client, so that it can display a partial page, and I also need 
to use gzip compression (only if the client supports it, of course).  This 
could be done in Apache 1 by using Dynagzip.

I couldn't make the built-in Deflate work, because it ignores flush commands 
and only writes output when its buffer is full.

So I wrote a new filter that generates gzipped output, and pushes data to the 
client upon a flush.  The filter is active only when it detects (and 
disables) the built-in Deflate filter, the idea being that the conditions for 
gzipping could be "borrowed" from existing Deflate options.  It turned out to 
be a lot smaller and easier than I thought it would be.  Even so, it's 
probably too big to post here; see it at: 
http://www.charbonnet.com/ChunkGzip.pm

It appears to work flawlessly with Gecko browsers.  The problem I'm having is 
with Internet Explorer 6.x.  Everything appears to be working normally (it 
displays the data up to each flush) until the page actually finishes 
downloading, at which time IE reloads the page and starts the script all over 
again, for a reason I don't understand.

Here's an extremely simple example of a script that might take advantage of 
this functionality which, only when viewed in IE, displays the odd reloading 
behavior:

use CGI qw(:standard);
my $r = shift;
print
    header,
    start_html,
    p('starting'),
  ;
$r->rflush;
sleep 3;    #"doing work"
print
    p('finished'),
    end_html,
  ;

I'm running the Debian Sarge versions of everything: Apache 2.0.54-4, mod_perl 
1.999.21-1.

This is my first attempt at an Apache filter, so there may simply be a glaring 
mistake or omission that's causing this.  I'd appreciate any advice you have!

Thanks,
Alex
[EMAIL PROTECTED]

Reply via email to