You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/11/24 17:33:55 UTC

[mp2] extending Apache::RequestRec::filename to optionally set its stat record

At the modperl list following the question documented at this entry's Note:
http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html#C_filename_

-----------------------------
Note that if you change the filename after the PerlMapToStorageHandler 
phase was run and expect Apache to serve it, you need to update its stat 
record, like so:

   use Apache::RequestRec ();
   use APR::Finfo ();
   use APR::Const -compile => qw(FINFO_NORM);
   $r->filename($newfile);
   $r->finfo(APR::Finfo::stat($newfile, APR::FINFO_NORM, $r->pool));

if you don't, Apache will still try to use the previously cached 
information about the previously set value of the filename.
------------------------------

I've suggested that we could make an option argument to filename() that 
will do that work automatically on behalf of users. Some folks seem to 
like the idea. What other developers think?

-- 
__________________________________________________________________
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] extending Apache::RequestRec::filename to optionally set its stat record

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
> 
> Stas Bekman wrote:
> 
>>At the modperl list following the question documented at this entry's Note:
>>http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html#C_filename_
>>
>>-----------------------------
>>Note that if you change the filename after the PerlMapToStorageHandler
>>phase was run and expect Apache to serve it, you need to update its stat
>>record, like so:
>>
>>  use Apache::RequestRec ();
>>  use APR::Finfo ();
>>  use APR::Const -compile => qw(FINFO_NORM);
>>  $r->filename($newfile);
>>  $r->finfo(APR::Finfo::stat($newfile, APR::FINFO_NORM, $r->pool));
>>
>>if you don't, Apache will still try to use the previously cached
>>information about the previously set value of the filename.
>>------------------------------
> 
> 
> you should note that "Apache" here really means "Apache's default, flat-file
> content handler" - the issue is that default_handler assumes nobody will
> play with anything, so it makes 304 decisions based on finfo and not a new
> stat of filename.

mind to commit that?

>>I've suggested that we could make an option argument to filename() that
>>will do that work automatically on behalf of users. Some folks seem to
>>like the idea. What other developers think?
> 
> 
> not surprisingly, I'm really not in favor of it :)

That's what I've expected and that's why I've forwarded it here.

-- 
__________________________________________________________________
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] extending Apache::RequestRec::filename to optionally set its stat record

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Stas Bekman wrote:
> At the modperl list following the question documented at this entry's Note:
> http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html#C_filename_
> 
> -----------------------------
> Note that if you change the filename after the PerlMapToStorageHandler
> phase was run and expect Apache to serve it, you need to update its stat
> record, like so:
> 
>   use Apache::RequestRec ();
>   use APR::Finfo ();
>   use APR::Const -compile => qw(FINFO_NORM);
>   $r->filename($newfile);
>   $r->finfo(APR::Finfo::stat($newfile, APR::FINFO_NORM, $r->pool));
> 
> if you don't, Apache will still try to use the previously cached
> information about the previously set value of the filename.
> ------------------------------

you should note that "Apache" here really means "Apache's default, flat-file
content handler" - the issue is that default_handler assumes nobody will
play with anything, so it makes 304 decisions based on finfo and not a new
stat of filename.

> 
> I've suggested that we could make an option argument to filename() that
> will do that work automatically on behalf of users. Some folks seem to
> like the idea. What other developers think?

not surprisingly, I'm really not in favor of it :)

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org