[mod_python] Crash on getting request's allowed_xmethods an boundary

Daniele Varrazzo dvarrazzo at virgilio.it
Mon Jul 19 21:03:54 EDT 2004


Hi everybody,

i'm experiencing crashing of the apache process when a mod_python handler
access the properties "boundary" and "allowed_xmethods" of the request
argument. This prevents the use of some interactive remote debuggers (such
ActiveState's) that try to read the contents of the variables in the
namespace and graphically present them in tree form.

I reported the crash on win32 platform. I am using python 2.3.4, apache
2.0.47, mod_python 3.1.3.

To show the bug here is a simple handler. It publishes the content of the
req object. Clicking on the url, the property is read and published.
Clicking on one of "allowed_xmethods" or "boundary" crashes apache. Actually
a plain read such as "x = req.boundary" is enough to crash.

from mod_python import apache

def handler(req):
    req.write("<html><body>")
    if req.args is None:
        for k in dir(req):
            req.write("<a href=%s?attr=%s>request.%s</a><br/>"
                      % (req.uri, k, k))
    else:
        attr = dict([ t.split('=') for t in req.args.split('&') ])['attr']
        req.write(str(getattr(req, attr)))

    req.write("</body></html>")
    return apache.OK

I published the script through:

<Directory "C:/httproot/test">
  AddHandler python-program .py
  PythonHandler mptest
  PythonDebug On
  PythonPath "['C:/httproot/test']+sys.path"
</Directory>

Daniele



More information about the Mod_python mailing list