Marco Lopes
mlopes at orangeway.org
Sat Dec 8 16:58:55 EST 2007
Thank you very much, for your help, I created a subdirectory with the following configurations: SetHandler mod_python PythonHandler index PythonDebug On Then I created a file named index.py with the following contents: from mod_python import apache def handler(req): req.content_type = 'image/jpg' req.write(req.read()) return apache.OK And managed to write a jpeg wich I posted for testing. Thank you again and sorry for beeing so extensive in this reply but I just wanted to send the an working example in the reply for those who need it later. On 12/8/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > > When using mod_python.publisher the POST data is always consumed. It > does this as by definition publisher always parses content for form > parameters. That is does this even when content type isn't form data > is arguable wrong. See: > > https://issues.apache.org/jira/browse/MODPYTHON-29 > > You would need to add an override for the specific URL in question and > route it to a basic mod_python handler and then you have full control > and thus full access to content of request. > > Graham > > On 09/12/2007, Marco Lopes <mlopes at orangeway.org> wrote: > > 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.py > > file 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 > > > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > http://mailman.modpython.org/mailman/listinfo/mod_python > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20071208/095367ec/attachment.html
|