perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yoder <yo...@mystrands.com>
Subject mod_perl2 / apache2 status codes
Date Tue, 04 Mar 2008 02:59:04 GMT
Hi,

I can't seem to find a resource that helps me with this problem.  
Dropping in mod_perl2 seems to change the status code of a simple CGI  
script:

     use CGI;
     use CGI::Carp qw(fatalsToBrowser);   # show fatal error messages  
in browser
     my $query = new CGI;
     my $status = "400 Bad Request";
     print $query->header( -type => 'text/plain', -status => $status );
     print "TESTING 400 BAD REQUEST";
     exit;

Under plain CGI, this returns a response:

     TESTING 400 BAD REQUEST

and a check of the response gives back 400.

However, under mod_perl2, I get back this

TESTING 400 BAD REQUEST<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0// 
EN">
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</h1>
<p>Your browser sent a request that this server could not  
understand.<br />
</p>
<hr>
<address>Apache/2.2.8 (Unix) DAV/2 mod_perl/2.0.3 Perl/v5.8.8 Server  
at localhost Port 8080</address>
</body></html>


The html message is from a 400 document, but the title (and response  
status) are 200 OK (not to mention their shouldn't be a html message  
for plain text). No amount of fiddling with options or googling has  
had any yield.

Any help would be appreciated.

Michael Yoder
yoder@mystrands.com

Additional Info:
This is a fresh install of darwinports, and via darwinports  
perl,apache2,mod_perl2 on a OSX 10.5 Leopard macbook pro.

Server configuration:
NameVirtualHost *
<VirtualHost *>
     ServerAdmin mod_perl@localhost
     ServerSignature On
     DocumentRoot /opt/local/apache2/cgi-bin
     LogLevel warn
     ErrorLog /opt/local/apache2/logs/error_log
     CustomLog /opt/local/apache2/logs/access_log combined

     PerlOptions +ParseHeaders
     PerlTaintCheck On
     PerlWarn On
     PerlConfigRequire /opt/local/apache2/cgi-bin/rec/ 
mod_perl_startup.pl

     # ModPerl::Registry mode (just change URL to run in different mode)
     Alias /perl-bin/ /opt/local/apache2/cgi-bin/
     # ModPerl::PerlRun mode (just change URL to run in different mode)
     Alias /perlrun-bin/ /opt/local/apache2/cgi-bin/

     # perl stays in memory, scripts loaded at startup as well
     <Location /perl-bin/>
         Options +ExecCGI
         PerlOptions +ParseHeaders
         SetHandler perl-script
         PerlHandler ModPerl::Registry
         Order allow,deny
         Allow from all
     </Location>

     # perl stays in memory, scripts loaded each time
     <Location /perlrun-bin/>
         Options +ExecCGI
         PerlOptions +ParseHeaders
         SetHandler perl-script
         PerlHandler ModPerl::PerlRun
         Order allow,deny
         Allow from all
     </Location>
</VirtualHost>

Startup Script:
use lib "/opt/local/apache2/cgi-bin/rec";
use Log::Log4perl ();
use ModPerl::Registry ();
1;






Mime
View raw message