problems with SocketServer rfile.read()

Wester wester at ilt.fhg.de
Tue Nov 7 18:50:26 CET 2000


Hi,

I want to make my own little http-server. So I derived a class from
BaseHTTPServer.BaseHTTPRequestHandler and implemented do_GET and
do_POST. With the do_POST method everything works fine as long as the
content-length transmitted by the client is correct. I read the
transmitted data with:

    contentlength =
string.atoi(self.headers.getheader('content-length'))
    data = self.rfile.read(contenlength)

But when the data section contains less then contentlength bytes
self.rfile.read(contenlength) hangs obviously
waiting for more bytes. Is there any way out of this problem?

Thanks

Rolf




More information about the Python-list mailing list