Re: [mp1] $r->document_root and subrequests

2005-06-06 Thread Geoffrey Young
> unless ($r->is_main) { > $r->log_error("not the main request; declining..."); > return DECLINED; > } > Is there a solution for this? that should probably by $r->is_initial_req, which returns true only for the main request, not subrequests. HTH --Geoff

[mp1] $r->document_root and subrequests

2005-06-06 Thread Ewan Edwards
return DECLINED; } my $file = $r->uri; # Capture the old DocumentRoot setting. my $old_docroot = $r->document_root; $r->log_error("$file - current docroot = $old_docroot"); # Set DocumentRoot to the new value. my $hostname = $r->hostname; my $new

Re: $r->document_root

2005-02-20 Thread Stas Bekman
. It might also be nice to have this method croak in a non-prefork mpm. It already does: MP_CROAK_IF_THREADS_STARTED("setting $r->document_root"); Joe, would you like to merge in the code you've posted before or do you want me to handle that? I can do it, but it'll t

Re: $r->document_root

2005-02-20 Thread Joe Schaefer
Stas Bekman <[EMAIL PROTECTED]> writes: > Geoffrey Young wrote: [...] >> automatic per-request is definitely the way to go if we can do it - >> people just don't understand the unusual scoping of this field, so >> helping them along is probably best. > > sure, let's do that. It might also be ni

Re: $r->document_root

2005-02-20 Thread Stas Bekman
Geoffrey Young wrote: The question is whether we want to make that docroot change persistent across requests [1] or per-request[2]. Geoff's proposal matches the former [1]behavior, whereas Joe's the latter[2]. I tend to think that per-request[2] is the sane solution. That's because you can never kn

Re: $r->document_root

2005-02-19 Thread Geoffrey Young
> The question is whether we want to make that docroot change persistent > across requests [1] or per-request[2]. Geoff's proposal matches the > former [1]behavior, whereas Joe's the latter[2]. > > I tend to think that per-request[2] is the sane solution. That's because > you can never know wheth

Re: $r->document_root

2005-02-19 Thread Stas Bekman
Geoffrey Young wrote: take a look at the implementation in mp1 - why won't something like that work, so long as we're in prefork? i.e. create a special scalar (quoting from mp1): SV *doc_root = perl_get_sv("Apache::Server::DocumentRoot", TRUE); sv_setsv(doc_root, ST(1)); con

Re: $r->document_root

2005-02-19 Thread Joe Schaefer
Stas Bekman <[EMAIL PROTECTED]> writes: [...] > I was just adding a note to the API method doc saying: > >it's important to mention that at the end of each request where >you modify this setting you absolutely must restore it to its >original value. > > but it doesn't work, since the

Re: $r->document_root

2005-02-19 Thread Geoffrey Young
> So unless I miss something we have two options: > > 1) nuke that method completely > > 2) either provide a new method that restores the data using a > preallocated string from the server pool or do that internally in the > server > > 3) or change $r->document_

Re: $r->document_root

2005-02-18 Thread Stas Bekman
Stas Bekman wrote: Cahill, Earl wrote: [...] Second, I couldn't get this $r->document_root(hostname2docroot($r->hostname)); [...] It's a bug. This patch which will go in shortly fixes it: [...] +conf->ap_document_root = apr_pstrdup(r->pool, SvPV_nolen(new_root))

Re: $r->document_root

2005-02-18 Thread Stas Bekman
Cahill, Earl wrote: [...] Second, I couldn't get this $r->document_root(hostname2docroot($r->hostname)); To set the docroot. However, each of the following worked my $new_docroot = hostname2docroot($r->hostname); $r->document_root($new_docroot); And $r->document_root(&quo

Re: $r->document_root

2005-02-15 Thread Geoffrey Young
> First, in my little test, I alternate between five different hosts, and > don't do the cleanup handler to put the docroot back, and everything looks > fine. you will eventually, once you get enough requests to cycle through all of the httpd children. > > Second, I could

RE: $r->document_root

2005-02-15 Thread Cahill, Earl
::RequestRec (); use Apache::RequestUtil (); use Apache::Const -compile => qw(DECLINED); sub handler { my $r = shift; my $new_docroot = hostname2docroot($r->hostname); $r->document_root($new_docroot); return Apache::DECLINED; } sub hostname2docroot { return "/var/docroot

Re: $r->document_root

2005-02-14 Thread Geoffrey Young
Geoffrey Young wrote: >> $r->document_root(hostname2docroot($r->hostname)); > > > you just can't do that without setting it back at the end of a request. see > > http://www.webreference.com/programming/perl/cookbook/chap4/2.html > > for why. I sh

Re: $r->document_root

2005-02-14 Thread Geoffrey Young
> $r->document_root(hostname2docroot($r->hostname)); you just can't do that without setting it back at the end of a request. see http://www.webreference.com/programming/perl/cookbook/chap4/2.html for why. > Can't locate object method "document_root" via p

$r->document_root

2005-02-14 Thread Cahill, Earl
; use warnings;   use Apache::RequestRec (); use Apache::Const -compile => qw(OK DECLINED);   sub handler {   my $r = shift;   $r->document_root(hostname2docroot($r->hostname));     return Apache::DECLINED; }   sub hostname2docroot {   my $hostname = shift || die "n