How to read POSTed data

Dan Perl danperl at rogers.com
Sat Feb 5 16:38:23 EST 2005


"Håkan Persson" <hakan at zyberit.com> wrote in message 
news:mailman.1980.1107622913.22381.python-list at python.org...
> Hi.
>
> I am trying to set up a simple HTTP-server but I have problems reading 
> data that is beeing POSTed.
>
> class httpServer(BaseHTTPServer.BaseHTTPRequestHandler):
>    def do_POST(self):
>        input = self.rfile.read()
>
> The self.rfile.read() will hang on the
> data = self._sock.recv(recv_size)
> line in the read() function in socket.py.
>
> Is there another way to read the data?

I'm not an expert on this subject, but I am in the process of looking at the 
code in BaseHTTPServer and other related modules.  What I see used is 
normally self.rfile.readline() and that makes more sense to me (intuitively) 
than read().  Have you tried that? 





More information about the Python-list mailing list