Read input in do_POST() method (was: embeddable Python web server)

Michael Ströder michael.stroeder at inka.de
Sat Feb 19 12:46:48 EST 2000


Michael Ströder wrote:
> 
> Frank Sergeant wrote:
> >
> >             if self.command == 'POST':
> >                form = string.strip (self.rfile.readline())
> 
> I had problems with HTTP-POST. In my case I read the data like
> module cgi does: self.rfile.read(contentlength). This works just
> fine when running as a normal CGI-BIN under the control of Apache. I
> tried your solution with readline() and it works now. Thanks.

Well, I'm pretty much confused about the details of using POST
method.
Here's what I experienced up to now:

Running as CGI-BIN using Apache:

Either self.rfile.read(contentlength) or self.rfile.readline() works
just fine with all browsers (lynx, w3m, Netscape etc.).

Running through own do_POST() method in a web server class derived
from SimpleHTTPServer.SimpleHTTPRequestHandler:

self.rfile.read(contentlength) works with lynx, w3m, but Netscape
4.7 hangs.

self.rfile.readline() works with w3m, Netscape 4.7, but lynx hangs.

Can anyone shed light on this?!?

Ciao, Michael.



More information about the Python-list mailing list