--- /tmp/CGI.pm-2.92/CGI.pm 2003-03-14 06:47:03.000000000 +1100 +++ /home/stas/perl/blead-ithread/lib/5.9.0/CGI.pm 2003-03-14 10:47:05.000000000 +1100 @@ -173,14 +173,18 @@ # Turn on special checking for Doug MacEachern's modperl if (exists $ENV{MOD_PERL}) { require mod_perl; - if (defined $mod_perl::VERSION && ($mod_perl::VERSION >= 1.99)) { - $MOD_PERL = 2; - require Apache::RequestRec; - require Apache::RequestUtil; - require APR::Pool; - } else { - $MOD_PERL = 1; - require Apache; + # mod_perl handlers may run system() on scripts using CGI.pm + # - make sure so we don't get fooled by inherited $ENV{MOD_PERL} + if (defined $mod_perl::VERSION) { + if ($mod_perl::VERSION >= 1.99) { + $MOD_PERL = 2; + require Apache::RequestRec; + require Apache::RequestUtil; + require APR::Pool; + } else { + $MOD_PERL = 1; + require Apache; + } } } @@ -1320,21 +1324,12 @@ push(@header,map {ucfirst $_} @other); push(@header,"Content-Type: $type") if $type ne ''; - if ($MOD_PERL and not $nph) { - my $r = Apache->request; - for (@header) { - my($k, $v) = split /:\s+/, $_, 2; - if ($k eq 'Content-Type') { - $r->content_type($v); - } - else { - $r->headers_out->{$k} = $v; - } - } - $r->send_http_header() if $MOD_PERL == 1; - return ''; - } - return join($CRLF,@header)."${CRLF}${CRLF}"; + my $header = join($CRLF,@header)."${CRLF}${CRLF}"; + if ($MOD_PERL and not $nph) { + Apache->request->send_cgi_header($header); + return ''; + } + return $header; } END_OF_FUNC