Hello...

 I'm trying to wrap an entire website in a perl handler. And then use
the $r->lookup_uri() to access some files in the domain.

httpd.conf:---------------------------8<--------------------------------------
<VirtualHost *>
  PerlAccessHandler   FOO_Access
  PerlResponseHandler FOO_Response
</VirtualHost>
FOO_Access.pm-------------------------8<--------------------------------------
package FOO_Access;

use Apache2::Const -compile => qw(:common);
use Apache2::RequestRec();

sub handler : method {
  my($class, $r) = @_;
  $r->handler('modperl');
  return Apache2::Const::OK;
}

1;
FOO_Response.pm:----------------------8<--------------------------------------
package FOO_Response;

use Apache2::Const -compile => qw(:common);
use Apache2::SubRequest ();
use Apache2::RequestRec();

sub handler : method {
  my($class, $r) = @_;
  my $subr = $r->lookup_uri('/index.php?a=1&b=2');
  return $subr->run();
}

1;
index.php:----------------------------8<--------------------------------------
<?php
if($_GET['set_cookie']) {
  Header('Set-Cookie: ' . $_GET['set_cookie']);
}
Header("Last-Modified: " . gmdate('D, d M Y H:i:s T', time()));
Header("Pragma: no-cache");
Header("Expires: 0");
Header("Cache-Control: no-cache, must-revalidate, max_age=0");
Header("Content-Type: text/html; charset=iso-8859-1");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>foo</title>
  </head>
--------------------------------------8<--------------------------------------

My strategy is to set the 'modperl' handler (for PerlResponseHandler) in
the PerlAccessHandler resulting in the modperl handler is not set when
using 'lookup_uri', providing access to a php script.

And this works like a charm (the content on the php-script is parsed and
executed), except for the headers. I don't get any headers generated
from the php-script. Is there any way of getting them through to the
user?

--------------------------------------8<--------------------------------------
$ echo "GET / HTTP/1.0\nHost: localhost\n" | nc localhost 8000 
Server: Apache/2.0.54 (Debian GNU/Linux) mod_perl/2.0.1 Perl/v5.8.4
Connection: close
Content-Type: httpd/unix-directory

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>foo</title>
  </head>
--------------------------------------8<--------------------------------------

Does anybody have any idea how to get a hold of the headers?


-- 
  Morten Bøgeskov (email: [EMAIL PROTECTED])

- But I do think that any model which fundamentally prevents people getting
  something they want is going to fail - D. Adams.     (on RIAA vs napster)

Reply via email to