03-19-06 04:38 PM
[ http://issues.apache.org/jira/brows...237
0972 ]
Graham Dumpleton commented on MODPYTHON-128:
--------------------------------------------
Back to the issue of whether when req.filename is modified that req.finfo be
updated automatically, the outcome in mod_perl 2.0 was that they did not pr
eserve the mod_perl 1.0 behaviour. Instead they note the issue in documentat
ion as:
filename
Get/set the filename on disk corresponding to this response (the result of t
he URI --> filename translation).
$filename = $r->filename();
$prev_filename = $r->filename($new_filename);
since: 2.0.00
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 Apache2::RequestRec ();
use APR::Finfo ();
use APR::Const -compile => qw(FINFO_NORM);
$r->filename($newfile);
$r->finfo(APR::Finfo::stat($newfile, APR::Const::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.
Now mod_perl is a bit different to mod_python in that it provides a much low
er level mapping to Apache internals than what mod_python does. As such it p
rovides a means of updating the finfo structure directly whereas mod_python
doesn't. The goal in mod_pe
rl is actually to make the API as close as possible to the Apache C API and
why they decided not to update finfo automatically.
The question still remains what should mod_python do? Because it doesn't pro
vide low level wrappers for stating files using APR routines nor of updating
finfo directly, should it therefore update finfo directly, or should it pro
vide some alternate means o
f updating it when desired?
For time being, will commit filetype changes and addition of constants as to
what filetype means, but defer having finfo updated automatically until som
e consensus of mod_python developers is reached.
> Have assigning req.filename automatically update req.finfo.
> -----------------------------------------------------------
>
> Key: MODPYTHON-128
> URL: http://issues.apache.org/jira/browse/MODPYTHON-128
> Project: mod_python
> Type: Improvement
> Components: core
> Versions: 3.3
> Reporter: Graham Dumpleton
> Assignee: Graham Dumpleton
[vbcol=seagreen]
>
> Although it is possible to assign a new value to "req.filename", it is not
possible to update "req.finfo" based on the new filename.
> Suggest that if "req.filename" is assigned a new value, that apr_stat() be
automatically called to update "req.finfo". Ie., internally mod_python woul
d do something like:
> apr_stat(&r->finfo, r->filename, APR_FINFO_MIN, r->pool);
> I believe that mod_perl supports a similar feature, but would need to conf
irm this.
> Related to "req.filename", the "req.canonical_filename" should also be writable as
when changing "req.filename" the latter should also by rights be updated as well.[/
vbcol]
[ Post a follow-up to this message ]
|