[jira] Commented: (MODPYTHON-128) Have assigning req.filename automatically update req.finfo.
[ http://issues.apache.org/jira/browse/MODPYTHON-128?page=comments#action_12372758 ] Graham Dumpleton commented on MODPYTHON-128: Tried to get some consensus on what to do about this issue on mod_python developers mailing list. See: http://www.mail-archive.com/python-dev@httpd.apache.org/msg01718.html http://www.mail-archive.com/python-dev@httpd.apache.org/msg01722.html http://www.mail-archive.com/python-dev@httpd.apache.org/msg01724.html http://www.mail-archive.com/python-dev@httpd.apache.org/msg01734.html http://www.mail-archive.com/python-dev@httpd.apache.org/msg01725.html http://www.mail-archive.com/python-dev@httpd.apache.org/msg01736.html but wasn't necessarily even able to get agreement on the point of whether the ability to update finfo is even needed. Have thus stopped working on the issue. Note that not having this ability means that MODPYTHON-123 can't be implemented as such a handler wouldn't be able to update finfo corresponding to filename matched to. 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (MODPYTHON-128) Have assigning req.filename automatically update req.finfo.
[ http://issues.apache.org/jira/browse/MODPYTHON-128?page=comments#action_12370963 ] Graham Dumpleton commented on MODPYTHON-128: Put dunce cap on, stand in corner. Naming is consistent now. Prefixes are never dropped. the FINFO_* and URI_* constants are special as there is no equivalent in Apache and they are only relevant to mod_python. Thus, contains should therefore be: mod_python.apache.APR_NOFILE mod_python.apache.APR_REG mod_python.apache.APR_DIR mod_python.apache.APR_CHR mod_python.apache.APR_BLK mod_python.apache.APR_PIPE mod_python.apache.APR_LNK mod_python.apache.APR_SOCK mod_python.apache.APR_UNKFILE 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 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (MODPYTHON-128) Have assigning req.filename automatically update req.finfo.
[ http://issues.apache.org/jira/browse/MODPYTHON-128?page=comments#action_12370970 ] Graham Dumpleton commented on MODPYTHON-128: Why can't I see the obvious today. Probably the best/easiest solution to the filetype member being missing is to add it to the end of the existing tuple and provide a new apache.FINFO_FILETYPE attribute for accessing it. Still need new constants for working out what its value means. 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 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (MODPYTHON-128) Have assigning req.filename automatically update req.finfo.
[ http://issues.apache.org/jira/browse/MODPYTHON-128?page=comments#action_12370972 ] 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: filename 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-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 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (MODPYTHON-128) Have assigning req.filename automatically update req.finfo.
[ http://issues.apache.org/jira/browse/MODPYTHON-128?page=comments#action_12367490 ] Graham Dumpleton commented on MODPYTHON-128: Here is link to discussion of similar change being ported from mod_perl 1 to mod_perl 2. http://www.gossamer-threads.com/lists/modperl/dev/8281 Their code was: +static MP_INLINE +char *mpxs_Apache__RequestRec_filename(pTHX_ request_rec *r, + SV *name) +{ +char *retval = r-filename; + +if (name) { +STRLEN len; +const char *val = SvPV(name, len); + +MP_TRACE_o(MP_FUNC, setting r-filename to %s\n, + val); + +/* set r-filename to the incoming value */ +r-filename = apr_pstrndup(r-pool, val, len); + +/* and update r-finfo so later calcuations work properly */ +apr_status_t rv = apr_stat(r-finfo, r-filename, + APR_FINFO_MIN, r-pool); + +if (rv != APR_SUCCESS) { + MP_TRACE_o(MP_FUNC, unable to update finfo for %s\n, +name); + r-finfo.filetype = 0; +} +} + +return retval; +} Worth noting is that they set finfo.filetype to 0 if stat fails. Consulting: http://docx.webperf.org/structapr__finfo__t.html http://docx.webperf.org/group__apr__file__info.html#gga3a66 http://docx.webperf.org/apr__file__info_8h-source.html rather than being assigned to zero, the constant APR_NOFILE should probably be used. Is finfo.filetype being 0/APR_NOFILE truely indicative of data not being valid by itself? Need to dig into apr_stat() further when have time. 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 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira