Stas Bekman wrote:
Stas Bekman wrote:

Lincoln Stein wrote:

Please find enclosed a beta version of CGI.pm 2.92. I would appreciate it if people could test it on both mod_perl 1 and mod_perl 2, as well as under normal CGI scripts too ;-)



Thanks Lincoln. 'make test' passes with mp1 and mp2


Ah, no it doesn't pass 1.0 tests. I was too quick to post. I've replaced send_cgi_header with direct setting of $r->headers_out without doing the special handling for several headers. I'll revert it to use send_cgi_header. I thought we could get rid of this function, but it's better to keep it.

Here is a new patch. I've attached it as well, in case it gets mangled.

I've also incorporated the defined() fix that I've commented on earlier. Please check if that's what you meant.

--- /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



__________________________________________________________________
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

Attachment: diff
Description: application/java-vm



Reply via email to