You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by yoder <yo...@mystrands.com> on 2008/03/06 18:39:13 UTC
[users@httpd] getting setup with apache2/modperl2: odd problem with status codes
Hi,
I'm trying to get setup with apache2/modperl2 and am seeing an odd
problem that I can't seem to find a resource/faq help on.
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;