Graham Dumpleton
grahamd at dscpl.com.au
Wed Mar 16 20:48:32 EST 2005
Point whatever form you are using at: http://dscpl.user.openhosting.com/~grahamd/testing/details.py Eg: <form action="http://dscpl.user.openhosting.com/~grahamd/testing/details.py" method="post"> <div> Handle: <input type="text" name="handle" maxlength="32"/> Password: <input type="password" name="password" maxlength="32"/> <input type="submit" name="login" value="Log in!"/> </div> </form> That URL will display various details about the request and for me at least for a post form, yields something for req.read(). As an example, try: http://dscpl.user.openhosting.com/~grahamd/testing/form.html You can see my code for generating this at: http://dscpl.user.openhosting.com/~grahamd/testing/form-html.txt http://dscpl.user.openhosting.com/~grahamd/testing/details-html.txt http://dscpl.user.openhosting.com/~grahamd/testing/details-py.txt I'll leave this up for a while, but will take it down at some point. Hope this helps. Graham Davin Boling wrote .. > (First of all, a big thanks to Graham for putting up with a thinly > veiled attempt of escapism from Too Many Mailing Lists syndrome. :) That > said, no offense to him, the e-mail he forwarded really wasn't mailing > list material: I just wanted a quick second opinion to make sure I was > sane.) > > > I was working with my own custom handler when I ran into a random > roadblock: for some reason the headers of submitted forms were being > eaten, and I'm not using mod_python.publisher! With req.read() returning > blank strings, it was obvious that util.FieldStorage(req) wasn't going > to be of much use. I also tried a simple test, which offered some very > bizarre results. I changed the top of my handler to the following: > > def handler(req): > test = req.read() > req.log_error(test) > > And this is what I get whenever I try to POST to it: > > [Wed Mar 16 19:27:53 2005] [error] [client X.X.X.X] GET, referer: > http://real.url/nothere > > Very interesting, GET instead of POST. Maybe my HTML was at fault? I > wrote up a small test form that was *nothing* but a good form: same result. > > > > At my wit's end, I wrote a quick handler from scratch and placed it into > the same environment. I didn't restart Apache, all I did was make a copy > of __init.py__ and overwrite it with a simple test. Interestingly > enough, the "handler from scratch" worked as expected: req.read() > returned a non-empty string, and req.method returned "POST". > > I overwrote __init.py__ again with the original version, and reran the > same form. ...Back to GET again. It makes no sense! It's like something > upstream is "eating" req.read(), but how is that possible when I'm > fetching the contents of req.read *at the start* of my handler(req) > function? > > Here's my Apache configuration for the virtual host in question, if it > helps: > > <VirtualHost 69.15.43.130:80> > ServerName foo.bar.baz > DocumentRoot /not/a/real/path > <Directory /not/a/real/path> > PythonDebug On > SetHandler mod_python > PythonHandler handler > <IfModule mod_access.c> > Order allow,deny > Allow from all > </IfModule> > </Directory> > </VirtualHost> > > > > (I'd share the code in question, but it's going to be placed in a secure > environment and I can't have it archived to the mailing list. I'll > report my results when I find the culprit, but in the meantime I'd > appreciate feedback on what people think might be going wrong.) > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|