You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rob Brown <ro...@0catch.com> on 2003/03/07 23:41:34 UTC

Re: [mp2] $r->document root("/my/hacked/path");

I need to be able to at least temporarily change the document_root on the 
fly.  Something like the following: 

$r->document_root("/my/hacked/path"); 

But it crashes with a prototype mismatch.  The docs say: 

$r->document_root:cannot currently be modified.  requires locking since it 
is part ofthe per-server config structure which is shared between threads 


Well, I could care less about actually modifying the server record. Isn't 
there a way to point it to a temporary string just for the request? 

In Apache1, it worked fine to copy the entire server record into a malloc 
and hack the document_root setting in the copy and point the server record 
pointer there just for the request.  Then free this temporary server record. 

Or in mod_perl, just set the document_root to the real path just long enough 
for the Translation phase and then fix it back to the original value in the 
Cleanup phase. 

What do you recommend in order to accomplish this under mod_perl 1.99 for 
Apache 2.0? 

Re: [mp2] $r->document root("/my/hacked/path");

Posted by Stas Bekman <st...@stason.org>.
Rob Brown wrote:
> I need to be able to at least temporarily change the document_root on 
> the fly.  Something like the following:
> $r->document_root("/my/hacked/path");
> But it crashes with a prototype mismatch.  The docs say:
> $r->document_root:cannot currently be modified.  requires locking since 
> it is part ofthe per-server config structure which is shared between 
> threads

its in todo/api.txt:
$r->document_root:
cannot currently be modified.  requires locking since it is part of
the per-server config structure which is shared between threads

> Well, I could care less about actually modifying the server record. 
> Isn't there a way to point it to a temporary string just for the request?
> In Apache1, it worked fine to copy the entire server record into a 
> malloc and hack the document_root setting in the copy and point the 
> server record pointer there just for the request.  Then free this 
> temporary server record.
> Or in mod_perl, just set the document_root to the real path just long 
> enough for the Translation phase and then fix it back to the original 
> value in the Cleanup phase.
> What do you recommend in order to accomplish this under mod_perl 1.99 
> for Apache 2.0?

It needs to be implemented. Patches are welcome.

__________________________________________________________________
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