You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/08/05 08:38:10 UTC

Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

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:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Stas Bekman <st...@stason.org>.
Bill Marrs wrote:
> 
>> Please report to the list the bug id so we can document this issue for 
>> those who have the same problem with older httpds. Thanks.
> 
> 
> OK, I've posted it.
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22259
> 
> Thanks for the fix!

For the archives: This bug has been fixed in the current httpd-2.0 cvs, and 
will be also in the soon to be released 2.0.48.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Bill Marrs <bi...@apocalypse.org>.
>Please report to the list the bug id so we can document this issue for 
>those who have the same problem with older httpds. Thanks.

OK, I've posted it.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22259

Thanks for the fix!

-bill


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Stas Bekman <st...@stason.org>.
Bill Marrs wrote:
> 
>> Try this patch:
>> [...]
>>
>> 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.
> 
> 
> I've just verified that your patch fixes my problem.

Great!

> I've never submitted a but report and fix to httpd-dev, but I'm willing 
> to do it.
> 
> How do I do it?

Open a bugzilla account and add a new bug report:
http://httpd.apache.org/bug_report.html

Please report to the list the bug id so we can document this issue for those 
who have the same problem with older httpds. Thanks.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Bill Marrs <bi...@apocalypse.org>.
>Try this patch:
>[...]
>
>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.

I've just verified that your patch fixes my problem.

I've never submitted a but report and fix to httpd-dev, but I'm willing to 
do it.

How do I do it?

-bill