[...]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));[...]
before it just happened to work in certain situation. Since the value wasn't copied, if you have changed the scalar after assigning it, it'd affect the doc root in an unpredictable way. You've detected it since you've passed a value returned by another function. In that case it returns a TMP scalar which is special, as perl reuses it whenever the function is re-invoked. That's why you weren't getting it to work. This patch does a proper copying of that string.
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 resetting will be allocated from the request pool, which will go away at the end of the request, leaving the data corrupted.
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_root method to accept the pool object and leave the users the headache of figuring out what they want to do. This is because if they use $r->pool and expect it stick beyond that request it won't work. If however they pass $r->server->pool and they do that on each request they leak memory.
Comments?
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com