Uploaded image for project: 'mod_python'
  1. mod_python
  2. MODPYTHON-160

req.add_handler/req.handler and PythonInterpPerDirective

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.8
    • Fix Version/s: 3.3.1
    • Component/s: core
    • Labels:
      None

      Description

      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:

      1. .htaccess

      SetHandler mod_python
      PythonInterpPerDirective On
      PythonFixupHandler interpreter_1

      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.

        Attachments

          Activity

            People

            • Assignee:
              grahamd Graham Dumpleton
              Reporter:
              grahamd Graham Dumpleton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: