Bill Marrs wrote:
[...]
You would probably wish to append your script with
additional output after the empty string? Something like:

#!/usr/bin/perl
$|=1;
print "Content-Type: text/html\n\n";
print "hello world<P>";
# This line causes the error (?)
print "";
print "hello again<P>";
---


When I do this, the mod_perl variant of the script fails to print "hello again<P>".

mod_cgi prints everything just fine and gets no errors.

I changed my test script to print a bunch of `date`'s
http://shevek.kenyonhill.com/cgi/test.pl
http://shevek.kenyonhill.com/perl/test.pl

Sorry for getting late to this thread, this is a bug in mod_deflate. You don't see it in mod_cgi, because mod_cgi doesn't really handle buffering and flushing, since it just reads the data from the pipe to the process. mod_deflate didn't follow the deflate() spec, saying that the caller shouldn't call deflate, when there is no data to deflate. Try this patch:


Index: modules/filters/mod_deflate.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_deflate.c,v
retrieving revision 1.26.2.5
diff -u -r1.26.2.5 mod_deflate.c
--- modules/filters/mod_deflate.c       17 May 2003 18:27:43 -0000      1.26.2.5
+++ modules/filters/mod_deflate.c       5 Aug 2003 06:37:59 -0000
@@ -529,9 +529,11 @@

         if (APR_BUCKET_IS_FLUSH(e)) {
             apr_bucket *bkt;
-            zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
-            if (zRC != Z_OK) {
-                return APR_EGENERAL;
+            if (ctx->stream.avail_in > 0) {
+                zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
+                if (zRC != Z_OK) {
+                    return APR_EGENERAL;
+                }
             }

ctx->stream.next_out = ctx->buffer;

Feel free to submit this bug report and the fix to httpd-dev. Please let me know if you do that, so I won't duplicate it. But I'd prefer that you do it so you can make sure that it gets fixed in the next release, since you need it working.

__________________________________________________________________
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



Reply via email to