perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Simon <wreckmyb...@yahoo.com>
Subject Re: Response Headers
Date Fri, 04 Oct 2002 13:47:13 GMT

 
 Randy Kobes wrote:
On Thu, 3 Oct 2002, Paul Simon wrote:

> 
> How do HTTP headers work under Registery::ModPerl?
> set up: windows2000 apache2.0.42 mod_perl/1.99_08-dev Perl/v5.8.0
> 
> I had to comment out the following in the CGI script:
> 
> #print "Expires: " . time2str( time() + 432000 ) . "\n";
> #print "Content-type: text/html\n\n";
> 
> because it would print out as content to the browser??
> 
> This is in the conf file:
> 
> Alias /standards/ "C:/Apache2/application/standards2/"
> 
> SetHandler perl-script
> PerlResponseHandler ModPerl::Registry
> #PerlOptions +ParseHeaders
> Options +ExecCGI
> 
> 
> If somebody could point me in the right direction ->
> 
> Thanks.

If you send the headers yourself, as, eg,
print "Content-type: text/html\n\n";
in the script, then you should have
PerlOptions +ParseHeaders 
in the relevant section. If you don't send the header yourself,
Apache will send one for you, based on, in particular, the
DefaultType setting. In this case you shouldn't have
PerlOptions +ParseHeaders
in that section. As you found, other combinations can lead
to a double set of headers sent, resulting in one of
them appearing in the browser.

-- 
best regards,
randy kobes


I have a pilot web app running with the above set-up (It's working really well, *fingers crossed*).
 

I understand your explanation. I'm still having problems with sending an Expires in the header.
 You mentioned, "Apache will send one for you, based on, in particular, the DefaultType setting."

Can I configure the DefaultType in apache?

The way I have it now is:
print "Content-type: text/html\n\n";
in the CGI script

And in the conf file:

<Location "/standards/">
     SetHandler perl-script
     PerlResponseHandler ModPerl::Registry
     PerlOptions +ParseHeaders
     Options +ExecCGI
</Location>

Here's the response header from the server:

HTTP/1.1 200 OK
Date: Fri, 04 Oct 2002 13:40:30 GMT
Server: Apache/2.0.42 (Win32) mod_perl/1.99_08-dev Perl/v5.8.0
Connection: close
Content-Type: text/html; charset=ISO-8859-1

My current goal is to cache the pages on the client browser.  Ultimately, I'd like to cache
on the server side too ( as you would've guessed :) ) I'm learning as I go... 



---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
Mime
View raw message