hi,
I have written an handler for authentication and when i try to return
the content of the requested file it just sends a document with out
SSi's which were included in the requested file.
I am attaching the file just to show how i am returning the file.
Any help in this is highly appreciated..
Thanks in advance
cheers
kiran
-----Original Message-----
From: Kenneth Lee [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 15, 2000 8:14 AM
To: Ken Williams
Cc: [EMAIL PROTECTED]
Subject: Re: mod_perl and ssi
I'm sending them because some of my scripts have to do redirection.
But why the problem only happens _occasionally_?
Anyway, in the meantime I'm passing the outputs directly to Apache::SSI,
Apache::SSI->new(
$output,
Apache->request)->output;
Ridiculous enough, but it seems to work fine.
Thanks,
Kenneth
Ken Williams wrote:
>
> Regarding the Filter approach, are you sending the headers yourself? You
> shouldn't. Filter will do that for you.
>
> Don't know much about the OutputChain approach.
>
> [EMAIL PROTECTED] (Kenneth Lee) wrote:
> >When I try the RegistryFilter+SSI approach, the headers generated by
> >my scripts _occasionally_ show up in the output (but as I see in SSI.pm,
> >there's really no header output when Filter is On). Provided that
> >PerlSendHeader is On, if I set it to Off, the headers always show up in
> >the output.
> >
> >I then try OutputChain+SSI, it almost works, but the #include's didn't
> >come up in the right place.
> >
> >Suppose the template looks like,
> >(hello.txt contains the text "hello!")
> >
> > <!--before-->
> > <!--#include virtual="/hello.txt"-->
> > <!--after-->
> >
> >Here's what I got,
> >
> > hello!
> > <!--before-->
> >
> > <!--after-->
> >
> >What's wrong with me?
> >
> >
package Apache::GateKeeper;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
my $ip = $r->get_remote_host; #DNS name or IP address
my($ret, $sent_pw) = $r->get_basic_auth_pw; # get the passwd info
my $file = $r->filename; # see where the user wants to go
my $type = "unlimited";
&init("/web/apache/src/modules/Apache/conf/unlimited.conf",$type);
foreach ( @$type )
{
if ( $_ eq $ip )
{
if ( -d $file )
{
$file .= "/index.html";
}
open (FILE, $file );
$r->send_fd(FILE);
close(FILE);
return OK;
}
}
}
sub init {
my $file = shift; # pass in the conf file
my $type = shift; # pass in what type ur checking for
open (FILE, "$file");
$/ = "\n";
while(<FILE>) {
chomp($_); # get rid of extra blank space
@$type[$i] = "$_";
$i++;
}
close(FILE);
}
1;