Issue Details (XML | Word | Printable)

Key: MODPYTHON-160
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

req.add_handler/req.handler and PythonInterpPerDirective

Created: 16/Apr/06 08:06 AM   Updated: 17/Apr/07 10:36 AM
Return to search
Component/s: core
Affects Version/s: 3.2.8
Fix Version/s: 3.3.1

Time Tracking:
Not Specified

Resolution Date: 16/Apr/06 01:50 PM


 Description  « Hide
MODPYTHON-125 made req.handler writable. Being able to now do this has uncovered a bug whereby if PythonInterpPerDirective is used mod_python can cause Apache to crash. Code to trigger the problem is:

# .htaccess

SetHandler mod_python
PythonInterpPerDirective On
PythonFixupHandler interpreter_1

# interpreter_1.py

from mod_python import apache

def fixuphandler(req):
    req.log_error("fixuphandler")
    req.log_error("interpreter=%s"%req.interpreter)
    req.log_error("directory=%s"%req.hlist.directory)
    req.handler = "mod_python"
    req.add_handler("PythonHandler","interpreter_1")
    return apache.OK

def handler(req):
    req.log_error("handler")
    req.log_error("interpreter=%s"%req.interpreter)
    req.log_error("directory=%s"%req.hlist.directory)
    req.content_type = 'text/plain'
    req.write('hello')
    return apache.OK

In summary, if PythonHandler is not used in Apache configuration to enable mod_python but it is done by assignment to req.handler in fixup phase and then req.add_handler() is used to add a handler to be called for content phase, and PythonInterpPerDirective is being used, mod_python will cause Apache to crash.

Location of crash not yet identified.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #394440 Sun Apr 16 06:46:36 UTC 2006 grahamd Using PythonInterpPerDirective when setting content handler to
run dynamically with req.add_handler() would cause Apache to
crash. (MODPYTHON-160)
Files Changed
MODIFY /httpd/mod_python/trunk/test/htdocs/tests.py
MODIFY /httpd/mod_python/trunk/test/test.py
MODIFY /httpd/mod_python/trunk/src/mod_python.c
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/Doc/appendixc.tex
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h