[EMAIL PROTECTED] wrote:
Hello list,


i'm trying to run a subrequest from within
a mod_perl content handler. The subrequest
is build from the request's 'lookup_file()'
method. Unfortunately, when i invoke the
'run()' method of the subrequest, no HTTP
headers are sent (even so the documentation
from 'Writing Apache Modules' claims that 'run()' "... will do
everything a response handler is supposed to, including sending the HTTP headers and the document body."


"... you must not send the HTTP header and document body yourself ..."

well, the Eagle book is a little out of date here


http://marc.theaimsgroup.com/?l=apache-modperl&m=96687764724849&w=2

subrequests do not include headers, so if you use $sub->run() to send the subrequest to the client you are required to send headers yourself.

to alter this behavior, use $sub->run(1).

see Recipe 3.16 in the Cookbook, which is available for free from Sams:

http://www.samspublishing.com/catalog/article.asp?product_id={B95F1178-BE9D-43A8-8061-6E351400EF7F}

HTH

--Geoff


Here's a short test case:


sub handler {
  my $req = shift;

my $filename = "/tmp/sample.html";


my $sub = $req->lookup_file($filename); $status = $sub->status; if($status == 200) { $ret = $sub->run; } return ret; }

Furthermore, if the filename given to 'lookup_uri()'
points to a directory, $sub->status will return '200'
but '$sub->run()' will return '301' (which is o.k. since
the filename should end with a '/' ...).

Any ideas?

Raf Mattes




Reply via email to