mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
httpserver.py: Pass Content-Length to read call
If a POST request is sent to the built-in http server the handling function does not terminate because the rfile.read() function blocks. This patch passes the Content-Length value to the self.rfile.read() function that is required for it to do not block the method. Regarding RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4) the Content-Length header is expected to be sent otherwise this patch assumes a zero length.
This commit is contained in:
parent
7d7945e719
commit
52bebde9df
@ -246,7 +246,8 @@ class SupyHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
'CONTENT_TYPE':self.headers['Content-Type'],
|
'CONTENT_TYPE':self.headers['Content-Type'],
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
form = self.rfile.read()
|
content_length = int(self.headers.get('Content-Length', '0'))
|
||||||
|
form = self.rfile.read(content_length)
|
||||||
self.do_X('doPost', form=form)
|
self.do_X('doPost', form=form)
|
||||||
|
|
||||||
def do_HEAD(self):
|
def do_HEAD(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user