On Tue, 2003-07-15 at 16:24, Stas Bekman wrote: > Philippe M. Chiasson wrote: > > On Thu, 2003-07-03 at 01:24, Bill Marrs wrote: > > > >>This fixed the bug for me. > > > > > > Great! Will commit it in the near future. (Can't seem to access the cvs > > server right now, crappy internet cafe) > > -1, this is a wrong solution. print ""; should flush just like it did in > mod_perl 1.0 if $| == 1; Consider this script: > > print "Content-type: text/plain\n\n"; > local $| = 0; > print "start\n\n"; > local $| = 1; > print ""; > sleep 5; > local $| = 0; > print "end\n"; > > print "", must immediately flush the buffered data, since $| has changed from > 0 to 1.
You are correct Stas, my fix was not appropriate. I've spent some time
today digging around for it.
Basically, to reproduce, you need to use ModPerl::RegistryBB
PerlModule ModPerl::RegistryBB
<Location /registry_bb>
PerlOptions +GlobalRequest
SetHandler perl-script
Options +ExecCGI
PerlResponseHandler ModPerl::RegistryBB
PerlOptions +ParseHeaders
SetOutputFilter DEFLATE
</Location>
Then hit the server with
#> GET -H'Accept-encoding: gzip' http://localhost:8529/registry_bb/print.pl
[error] 30146: ModPerl::RegistryBB: 20014:Error string not specified yet at
ModPerl-Registry/t/cgi-bin/print.pl line 6.
And I've found what's hapenning. It's mod_deflate output filter that's not proprely
handling flush buckets, IMO.
From mod_deflate.c:520
if (APR_BUCKET_IS_FLUSH(e)) {
apr_bucket *bkt;
zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
if (zRC != Z_OK) {
return APR_EGENERAL;
}
ctx->stream.next_out = ctx->buffer;
len = c->bufferSize - ctx->stream.avail_out;
b = apr_bucket_heap_create((char *)ctx->buffer, len,
NULL, f->c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(ctx->bb, b);
ctx->stream.avail_out = c->bufferSize;
bkt = apr_bucket_flush_create(f->c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(ctx->bb, bkt);
ap_pass_brigade(f->next, ctx->bb);
continue;
}
Seems like the call to deflate() returns some error (sounds to me like
mod_defalte expects a FLUSH bucket to come _after_ some data was
processed, not an empty brigade with _just_ a FLUSH bucket.
In that case, deflate() returns Z_BUF_ERROR and mod_deflate's output
filter proceeds to bailing out with APR_EGENERAL (20014, BTW) and we get
our annoying warning.
So the good news is that's it a bug in mod_deflate ;-)
And the bad news is that someone more familier with zlib than me could
probably figure out how to know there is no new data available, bypass
the compression and just pass a flush bucket along.
>
> > One thing that could help is if someone could take the time to write a
> > test for this bug.
>
> Unfortunately I don't seem to be able to reproduce the problem, so I can't
> debug the problem. It could be a bug on the mod_deflate's behalf as well.
> Philippe, were you able to reproduce the problem with Bill's setup? I was
> writing a test, but couldn't get it to fail... may be because i was using
> 2.0.47. Bill, do you have the problem with the latest apache version?
>
> Also Bill, why do you have this setup:
>
> <Location /perl>
> AddOutputFilterByType DEFLATE text/*
> SetOutputFilter DEFLATE
> </Location>
>
> why adding it twice? You need only the latter inside <Location>, or
> alternatively only the former outside <Location> if you want it to be set
> globally:
> http://httpd.apache.org/docs-2.0/mod/core.html#addoutputfilterbytype
>
> __________________________________________________________________
> Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
--
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
signature.asc
Description: This is a digitally signed message part
