Subject: | CGI sends premature headers on mod_perl 2 |
We have updated CGI.pm to v3.31 on our development servers and some of
our programs (those that run under mod_perl 2) now send the headers
prematurely. In our research, we've tried a lot of changes on our code
without success. As a last effort, we changed one line on CGI.pm and
everything works now.
We still aren't sure if this is a bug. Anyway, here goes our findings.
Line 40: $MOD_PERL = 0;
Line 190-1: if (exists $ENV{MOD_PERL_API_VERSION} &&
$ENV{MOD_PERL_API_VERSION} == 2) {
$MOD_PERL = 2;
Line 197-8: } else {
$MOD_PERL = 1;
Line 1525: if (($MOD_PERL==1) && !$nph) {
If we change this last line to: if(($MOD_PERL>=1) && !$nph) {
headers are sent correctly.
diff:
1525c1525
< if (($MOD_PERL==1) && !$nph) {
---
Show quoted text
> if (($MOD_PERL>=1) && !$nph) {
------------------
$ perl -v
This is perl, v5.8.8 built for i486-linux-thread-multi
$ perl -MCGI -le 'print CGI->version'
3.31
$ apachectl -v
Server version: Apache/2.2.6 (Unix)
Server built: Sep 20 2007 19:35:34
'MOD_PERL' => 'mod_perl/2.0.3',
'MOD_PERL_API_VERSION' => 2,