Issue Details (XML | Word | Printable)

Key: MODPYTHON-157
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Graham Dumpleton
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

PythonInterpPerDirectory broken for directory request in fixup phase and earlier.

Created: 09/Apr/06 07:54 PM   Updated: 17/Apr/07 10:28 AM
Return to search
Component/s: core
Affects Version/s: 2.7.10, 3.1.4, 3.2.8
Fix Version/s: 3.3.1

Time Tracking:
Not Specified

Resolution Date: 10/Apr/06 12:30 PM


 Description  « Hide
The PythonInterpPerDirectory request creates distinct interpreters for each directory in the file system. The name of the directory is derived from req.filename.

In determining the name of the interpreter from req.filename, it always assumes that if the request is against the directory and not a file in it, that req.filename will always have a trailing slash appended to it. This however is not the case, as trailing slash redirection is only performed by mod_dir at the end of the fixup handler phase. Thus the name of the interpreter will be wrong for handler run in fixup handler pahse or earlier and will actually be that of the parent directory.

The code in select_interp_name() of src/mod_python.c which determines interpreter name is:

            /* base interpreter on directory where the file is found */
            if (req && ap_is_directory(req->pool, req->filename)) {
                /** XXX I suppose that if req->filename is a directory, there already
                    is a trailing slash in req->filename. This is due to the fact
                    that Apache redirect any request from /directory to /directory/.
                    That's why the tests below are commented out, they should be useless.
                **/
                /* if (req->filename[strlen(req->filename)-1]=='/') { */
                    return ap_make_dirstr_parent(req->pool, req->filename);
                /* }
                else {
                    return ap_make_dirstr_parent(req->pool,
                                                apr_pstrcat(req->pool, req->filename,
                                                            "/", NULL ));
                } */
            }

Note that it actually has the code that would be required for this to work properly but it is commented out because of a wrong assumption that the trailing slash would always be there.

Code simply has to be uncommented.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Graham Dumpleton made changes - 10/Apr/06 12:28 PM
Field Original Value New Value
Assignee Graham Dumpleton [ grahamd ]
Graham Dumpleton made changes - 10/Apr/06 12:28 PM
Status Open [ 1 ] In Progress [ 3 ]
Graham Dumpleton made changes - 10/Apr/06 12:30 PM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Fix Version/s 3.3 [ 12310101 ]
Graham Dumpleton made changes - 17/Apr/07 10:28 AM
Status Resolved [ 5 ] Closed [ 6 ]