perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruben Safir <ru...@mrbrklyn.com>
Subject Re: lost directory indexes
Date Mon, 15 Sep 2014 21:40:00 GMT
> >
> >
> >Now the error log for an index request says:
> >
> >[Mon Sep 15 12:14:09 2014] [error] [client 10.0.0.57] Attempt to serve
> >directory: /usr/local/apache/htdocs/resources/, referer:
> >http://www.mrbrklyn.com/
> >INDEXES ON
> >SYMLINKS OFF
> >CGI OFF
> >
> >
> >It knows that INDEXES is on but it is ignoring the config files fault.
> >
> >I suppose I need to identify the directory request and then
> >decline to respond to it.
> 
> Yes.
> 
> >But I have no idea how to do this.
> 
> Have you tried
> 
> return DECLINED; # ?
> 


I think I need return Apache2::Const::DECLINED;

It is recieving a DECLINED but it is not acting according to what you
wrote here.


> See first this : http://perl.apache.org/docs/2.0/user/handlers/http.html#HTTP_Request_Cycle_Phases


> 
> Leave that page open in a tab, to refer to it during the rest.
> 
> Then open this page in another tab, and read it, up to the RUN_ALL label.
> 
> (Really do this; it takes only a few minutes, and it will save you a
> lot of time in the long run)
> 
> Then see : http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlResponseHandler
> and then follow the RUN_FIRST links, to
> http://perl.apache.org/docs/2.0/user/handlers/intro.html#item_RUN_FIRST
> and then to
> http://perl.apache.org/docs/2.0/user/handlers/intro.html#C_RUN_FIRST_
>

Yes - I have poured over this docs today.
 
> Summary :
> 
> When you install you own mod_perl response handler, it gets pushed
> "on top" of the Apache default handler, so it gets called first.
> 
> If your response handler really generates a response, it should
> return OK, so that Apache does not run any more response handlers
> after that (not even the default handler, see below), and skips to
> the next phase (Logging). (Your handler can also return an error
> code, and that also aborts the Response phase and goes to Logging.)
> If your handler decides not to generate a response for this request
> (but leave it for another handler to do that), then it should
> respond DECLINED, 

It does this.  This is the code:

        if ($gate =~ m{///}){
                print STDERR "I have a match\n";
                $r->log_reason("Access Forbidden", $r->filename);
                return Apache2::Const::FORBIDDEN;
        }else{
                print STDERR "Declining: $gate \n";
                return Apache2::Const::DECLINED;
        }

> so that Apache runs the next handler in the chain.

Whatever apache is running after this is does not include anything
that is supposed to identify indexes or dir_module (the discovery of
index.html).  These things are not happening even as I change the handle
type from PerlResponseHandle to PerlAccessHandler to PerlTransHadler

None of it.

Even if I put 
 return Apache2::Const::DECLINED;

right at the top of the module:
package URL_BLOCK;

use strict;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Access;
use Apache2::Const -compile => qw(:common);
use Apache2::Const -compile => qw(:options);

sub handler{
        my $r = shift;
        return Apache2::Const::DECLINED;
        my $gate = $r->unparsed_uri;


....

Still it can no longer identify index.html or perform any fancy
indexing.

ONLY if I remove the perl handler from the location, only then will
indexing work correctly.




> Eventually, if all the installed Response handlers respond DECLINED,
> Apache will run its default response handler.

that default handler evidently does not include fancy indexing or 
option Indexes

> This default handler is always there, at the end of the Response
> handlers chain.  It is the one which tries to respond to the request
> by sending a static file (e.g. a html page on disk) or the content
> of a directory.
> That's what you want, here; so return DECLINED.

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


Mime
View raw message