> -----Original Message-----
> From: Jim Sproull [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 06, 2000 1:53 PM
> To: [EMAIL PROTECTED]
> Subject: RE: NEWBIE: appending to page content
> 
> 
> 
>  Thanks to Geoff Young for pointing me in the right direction towards
> Apache::SimpleReplace.  I have made my own stripped down 
> version of this,
> but still need guidance (Geoff, you're welcome to reply again 
> if you can
> help ;)  Since I only want all text/html pages to be appended 
> to, I want all
> other types to be sent asis.  Here's what I'm doing now:
> 
> in conf:
> <Location />
>        SetHandler perl-script
>        PerlHandler AddData
> </Location>
> 
> in lib/perl/AddData.pm:
> 
> sub handler {
>         my $r = shift;
>         $log = $r->server->log;
> 
>         log_info("Opening ". $r->filename . " w/ type of " .
> $r->content_type);
> 
>         $rqh = Apache::File->new($r->filename)
>                     || return SERVER_ERROR;
> 
>         $r->send_http_header();
>         $r->send_fd($rqh);
> 
>         if ($r->content_type eq "text/html") { # it's HTML
>                 log_info("Appending extra data ");
>                 $r->print("testing");
>         }
> 
>         return OK;

try returning DECLINED if $r->content_type is 'httpd/unix-directory' or
matches directory or something similar.  put this at the top of your handler
so that the decline is topmost and you avoid unnecessary processing... this
will let apache's normal directory indexing take over when appropriate...

HTH

--Geoff

> }
> 
>   This works fine for specified html pages.  However, when a 
> DirectoryIndex
> page is called indirectly (http://www.foobar.com/ for 
> instance), an item of
> type httpd/unix-directory gets printed.  So, I guess I'm 
> asking 'in what
> stage does the DirectoryIndex get called, and why is it being 
> ignored in
> this case?'
> 
> Jim
> [EMAIL PROTECTED]
> 

Reply via email to