You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mårten Svantesson <ma...@travelocitynordic.com> on 2008/06/03 12:17:04 UTC

[mp2] "did not send an HTTP header" due to (involuntary) flush

We are migrating a big site from mod_perl1 to mod_perl2. The site originally was written as CGIs so headers are mostly set with print statements. The
Content-Type are mostly printed in the end of the script.

The problem is that we occassionally start processes from the scripts and then the output gets flushed and thus we get Internal Server Error with the
message "did not send an HTTP header" in the error.log.

I tried to write an output filter that merge all buckets until \n\n is encountered, but I don't seem to be able to insert the filter so that it
executes before the mod_perl header parsing.

Looking in the mailing list archive it seems like this problem was extensively discussed in the thread "[mp2] CGI redirects incorrectly handled?" back
in March 2003. In the final mail of the thread <http://article.gmane.org/gmane.comp.apache.mod-perl/4889> Stas mentions possible future changes to
alleviate the problem. Has anything of this been implemented?

Or does anybody have any other idea how to solve this (without rewriting our scripts, which are *many*)?

We are now running mod_perl 2.0.2 (the version available in RedHat EL) in Apache 2.2.3.

Our configuration:

<FilesMatch "\.(cgi|pl|pl5)$">
     SetHandler perl-script
     PerlFixupHandler Apache2::SizeLimit
     PerlResponseHandler ModPerl::Registry
     PerlOptions +ParseHeaders
</FilesMatch>

-- 
  Mårten Svantesson