You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by bill chmura <WB...@Ensign-BickfordInd.com> on 2000/06/15 18:50:06 UTC

Header issues with Mod_Perl and CGI.pm

I cannot seem to get this to work correctly.  I just got Mod_Perl 
installed on my webserver (Apache 1.3.3 on HPUX)

I am trying to get a script working that sets a cookie on the users 
machine -.  This is where it goes all wrong.

The script uses CGI.pm (v 2.36)  to do everything from headers to 
cookies and redirects.
If run by itself it works okay, then I add this to the mix

<location /cgi-bin/modperl>
PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::PerlRun
Options +ExecCGI
</location>

It still works, however it does not set cookies on the users machine.  
It does however successfully send a redirect back.

So I figured the PerlSendHeaders is screwing me over.

if I turn off the PerlSendHeader it does not work.  The browser returns 
a "The server has returned an invalid or unrecognized response".   

When I run the script from the command line I get a set of headers back 
that look exactly like the ones that the non-mod_perl is running.  

Status: 302 Found
Set-cookie: emailpolicy=111;expires=blah blah blah
Date: Date here
Uri: http://redirectto.com/file
Location: http://redirectto.com/file
Content-type: text/html
[newline]

Does anyone know why this may be giving me problems?

Thanks for anyhelp!!

NOTE:  I also put a small test script on to make sure that the Mod_perl 
stuff was working
#!/opt/perl5/bin/perl
use strict;
print "Content-type: text/html\n\n";
print "<HEAD><TITLE></TITLE></HEAD>\n";
print "<BODY><PRE>\n";
print map { "$_ = $ENV{$_}\n" } sort keys %ENV;
print "</PRE></BODY>\n";

With PerlSendHeaders off, it does the same invalid response, with it on 
- everything is fine

(It was a small script so I rewrote it to use the Registry and 
Apache::Cookies and Apache::Request only to find out that they were not 
put on the machine by the systems people.  I cant install them from 
CPAN because the system does not have an ANSI C compiler.  So for now, 
I think I am stuck doing it this way.  I know this probably isnt the 
right list to ask, but if anyone knows of a way to get the 
Apache::Bundle running on an HPUX box - I would be greatful)


Re: Header issues with Mod_Perl and CGI.pm

Posted by Ged Haywood <ge...@jubileegroup.co.uk>.
Hi there

On Thu, 15 Jun 2000, bill chmura wrote:

> I cant install them from CPAN because the system does not have an
> ANSI C compiler.

So get one.  It's free:)

73,
Ged