Hi folks!

I'm writing my own web server in python, and I'm getting problems to handle
POST requests.
This is a snippet of my code (of an HttpRequest class):

try:
   length = int(self.myRequestHandler.headers.get('content-length', 0))
except ValueError:
   length = 0
pdata = self.myRequestHandler.rfile.read(length)
# extract POST data from pdata

The application is executed normally, the response is sent back to the
client, but something is keeping the connection open. I discovered that the
problem is in the lines above, but no exception is raised. I tested
replacing this line:
pdata = self.myRequestHandler.rfile.read(length)

by this:
pdata = self.myRequestHandler.rfile.read(length-1)

On this way, the web server works fine, and close the connection after
response ends. But my request is uncomplete, because the last char is not
readed.
I don't know what to do anymore. I need help =/

Thanks in advance.

--
   Rodolfo Carvalho
    Web Developer
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to