Re: Strange subrequest dir_config issue

2002-05-24 Thread Matt Sergeant

On Thu, 23 May 2002, Geoffrey Young wrote:

 Matt Sergeant wrote:

  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  This is just a heads up on something I've not seen documented in either the
  Eagle book or in the Cookbook (at least not that I can find).
 
  If you create a subrequest via $r-lookup_file(), the per_dir_config entry
  doesn't seem to be created. If you use $r-lookup_uri(), it's fine. This can
  be an issue for people with complex applications and configurations trying to
  find out why $sub-dir_config() might not be returning what they expect.
 
  Took me a while to figure this one out - just thought others might like to
  know.


 well, I hadn't thought about it until now, but actually that makes sense to me (as 
it's
 early in the morning here :)

 mod_perl just uses r-per_dir_config for $r-dir_config, so it's relying on Apache's
 merging behavior wrt lookup_file() and lookup_uri().  one of the things that 
lookup_uri()
 does that lookup_file() does not do is call location_walk, which merges 
per-directory configs.

 I think this makes sense, since a single file can be served by multiple Location
 containers, and with lookup_file() you're essentially telling Apache that you 
already know
 the filename (sans the translation phase) and you don't really need to know how it 
relates
 to the incoming URI.  both lookup_file() and lookup_uri() call the File and 
Directory
 merging routines, so I would expect that calling lookup_file() on files governed by 
those
 directives would merge just fine.

 actually, I ran the below test against my perl-bin/ and cgi-bin/ setups (where 
perl-bin is
 a Location + Alias and cgi-bin is a Directory + ScriptAlias) and it works as I 
suspected.

 does this help?

Well it all made sense to me anyway - I just thought it should be
documented ;-)

-- 
!-- Matt --
:-Get a smart net/:-




Re: Strange subrequest dir_config issue

2002-05-24 Thread Per Einar Ellefsen

At 12:38 24.05.2002, Matt Sergeant wrote:
Well it all made sense to me anyway - I just thought it should be
documented ;-)

Thanks a lot Matt and Geoffrey, I have added this to the documentation 
(waiting for Stas to commit it).

It seems to me that it's a more general problem with assuming too much 
about Location blocs. When you call lookup_file(), the URI isn't known, 
so Location blocks aren't processed. This means that if you were 
pretending to call a mod_perl script run under Apache::Registry, it won't 
actually run under Apache::Registry either (if you configured with a 
Location block that is). The solution as you said is using Directory 
and Files for these rare cases.


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Strange subrequest dir_config issue

2002-05-23 Thread Geoffrey Young



Matt Sergeant wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 This is just a heads up on something I've not seen documented in either the 
 Eagle book or in the Cookbook (at least not that I can find).
 
 If you create a subrequest via $r-lookup_file(), the per_dir_config entry 
 doesn't seem to be created. If you use $r-lookup_uri(), it's fine. This can 
 be an issue for people with complex applications and configurations trying to 
 find out why $sub-dir_config() might not be returning what they expect.
 
 Took me a while to figure this one out - just thought others might like to 
 know.


well, I hadn't thought about it until now, but actually that makes sense to me (as 
it's 
early in the morning here :)

mod_perl just uses r-per_dir_config for $r-dir_config, so it's relying on Apache's 
merging behavior wrt lookup_file() and lookup_uri().  one of the things that 
lookup_uri() 
does that lookup_file() does not do is call location_walk, which merges per-directory 
configs.

I think this makes sense, since a single file can be served by multiple Location 
containers, and with lookup_file() you're essentially telling Apache that you already 
know 
the filename (sans the translation phase) and you don't really need to know how it 
relates 
to the incoming URI.  both lookup_file() and lookup_uri() call the File and 
Directory 
merging routines, so I would expect that calling lookup_file() on files governed by 
those 
directives would merge just fine.

actually, I ran the below test against my perl-bin/ and cgi-bin/ setups (where 
perl-bin is 
a Location + Alias and cgi-bin is a Directory + ScriptAlias) and it works as I 
suspected.

does this help?

--Geoff



use Apache::Constants qw(OK);
use strict;

my $r = shift;

#my $sub = $r-lookup_file('/usr/local/apache/perl-bin/env.pl');
my $sub = $r-lookup_uri('/perl-bin/env.pl');

$r-send_http_header('text/plain');
print $r-uri, :\n;

$sub-dir_config-do(sub {
   my ($field, $value) = _;
   print $field = $value\n;
   1;
});

return OK;






Strange subrequest dir_config issue

2002-05-21 Thread Matt Sergeant

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This is just a heads up on something I've not seen documented in either the 
Eagle book or in the Cookbook (at least not that I can find).

If you create a subrequest via $r-lookup_file(), the per_dir_config entry 
doesn't seem to be created. If you use $r-lookup_uri(), it's fine. This can 
be an issue for people with complex applications and configurations trying to 
find out why $sub-dir_config() might not be returning what they expect.

Took me a while to figure this one out - just thought others might like to 
know.

- -- 
:-get a SMart net/:-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE86ryEVBc71ct6OywRAkdkAKDR4kAQWpcy0voSgDfnN+Emo843vQCdGh4n
BswYva0r+TTJiSlN8xG0KCg=
=+DU7
-END PGP SIGNATURE-