You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Frank Maas <fr...@cheiron-it.nl> on 2003/03/08 02:35:26 UTC

What does SetHandler do unexpectedly?

Hi,

Well, by now you must know that I am working on something... and I 
keep stumbling on things I seem not to understand and not to be 
able to find in the docs / books.

See this example:

<Location />
  # SetHandler perl-script
  PerlHeaderparserHandler MyClass->first
  PerlAuthenHandler MyAuthen
  PerlFixupHandler MyClass->init
  # PerlHandler MyClass->handler
  PerlCleanupHandler MyClass->last
</Location>

I have stripped almost all functionality and just let the subroutines
print. With this setup and a 'get http://mysite/dir/file' I see:
-- first: got /dir/file
---- authen: called for /dir/file
---- init: called for /dir/file
[error] ... /dir/file not found
-- last:  finished /dir/file

No strange things, what I would expect. But now I remove the comments
and see what happens:

-- first: got /dir/file
---- authen: called for /dir/file
---- init: called for /dir/file
---- authen: called for /file
---- init: called for /file
---- handler: called for /dir/file
[error] ... /dir/file not found
-- last:  finished /dir/file

What strike me are the two lines for /file. Why is this happening? I
did not ask for it, at least not deliberately. Is this something 
that is related to a Handler (check one level below the uri)?

Hope you can help me here (and on the other subjects...)

--Frank

Re: What does SetHandler do unexpectedly?

Posted by Stas Bekman <st...@stason.org>.
Frank Maas wrote:
> Hi,
> 
> Well, by now you must know that I am working on something... and I 
> keep stumbling on things I seem not to understand and not to be 
> able to find in the docs / books.
> 
> See this example:
> 
> <Location />
>   # SetHandler perl-script
>   PerlHeaderparserHandler MyClass->first
>   PerlAuthenHandler MyAuthen
>   PerlFixupHandler MyClass->init
>   # PerlHandler MyClass->handler
>   PerlCleanupHandler MyClass->last
> </Location>
> 
> I have stripped almost all functionality and just let the subroutines
> print. With this setup and a 'get http://mysite/dir/file' I see:
> -- first: got /dir/file
> ---- authen: called for /dir/file
> ---- init: called for /dir/file
> [error] ... /dir/file not found
> -- last:  finished /dir/file
> 
> No strange things, what I would expect. But now I remove the comments
> and see what happens:
> 
> -- first: got /dir/file
> ---- authen: called for /dir/file
> ---- init: called for /dir/file
> ---- authen: called for /file
> ---- init: called for /file
> ---- handler: called for /dir/file
> [error] ... /dir/file not found
> -- last:  finished /dir/file
> 
> What strike me are the two lines for /file. Why is this happening? I
> did not ask for it, at least not deliberately. Is this something 
> that is related to a Handler (check one level below the uri)?
> 
> Hope you can help me here (and on the other subjects...)

Try to see if this helps:
http://search.cpan.org/author/DOUGM/Apache-Module-0.11/lib/Apache/ShowRequest.pm

We certainly can't guess what other handlers and configurations you may have 
that affect the process. it looks like something runs a sub-request, you may 
want to add to your authen handler an extra printout checking if it's inside a 
subrequest:

warn $r->is_initial_req ? "main req\n" : "sub req\n";

it seems like your transhandler is returning DECLINED and Apache's default 
handler is running, trying to find /dir/file, and then trying /file. Or you 
may have something else. It's of no help to guess.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com