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 
preserve the mod_perl 1.0 behaviour. Instead they note the issue in 
documentation as:


  Get/set the filename on disk corresponding to this response (the result of 
the 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->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 lower 
level mapping to Apache internals than what mod_python does. As such it 
provides a means of updating the finfo structure directly whereas mod_python 
doesn't. The goal in mod_perl 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 
provide low level wrappers for stating files using APR routines nor of updating 
finfo directly, should it therefore update finfo directly, or should it provide 
some alternate means of 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 some 
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

> 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 would 
> 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 confirm 
> 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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

Reply via email to