[mod_python] How to read raw post in mod_python?

Marco Lopes mlopes at orangeway.org
Sat Dec 8 15:42:15 EST 2007


Hi,

I'm giving my first steps in mod_python and I seem to be having some
problems to get the unprocessed post data.
I've been trying req.read() but the return result is empty, I tried it
without parameters, with the content-length and with some value higher than
the content-length but it still returned empty.
The content-length in the req.headers_in come with a non-zero value but the
variable req.clength is always 0.

First I used the following mod_python apache configuration:

    <Directory /var/www/test>
            AllowOverride AuthConfig
            Order allow,deny
            Allow from all

            DirectoryIndex index.py
            SetHandler mod_python
            PythonHandler mod_python.publisher
            PythonDebug On
    </Directory>


Then I found something in the mailling list about a problem that could occur
with that configuration that could cause strange behaviour leading to empty
or corrupt data in GET and/or POST data (because of not using the
index.pyfile name, this could be an old problem alredy addressed but I
can't
remember the message date) and I tried the following configuration:

    <Directory /var/www/test>
            AllowOverride AuthConfig
            Order allow,deny
            Allow from all

            AddHandler mod_python .py
            PythonHandler mod_python.publisher
            PythonDebug On
    </Directory>


The req.read() call continued to return empty.
I checked the req.form and the POST is there already processed, I'm thinking
that if I could find a way to tell mod_python not to process the post I
could then use req.read() to get the raw post.

Can anyone give-me any information that could help me with this?

Thanks,
Marco Lopes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20071208/9bdf11b0/attachment.html


More information about the Mod_python mailing list