Fix UiServer.getPosted hanging in some circumstances
fixes #198 while it's not exactly clear what causes the difference in behaviour, but under certain conditions UiServer.getPosted used to hang trying to readline() POST request (e.g. from UiPassword login). using read(CONTENT_LENGTH) seems to fix the issue
This commit is contained in:
parent
19056b408a
commit
c92b8bc56c
1 changed files with 5 additions and 1 deletions
|
@ -231,8 +231,12 @@ class UiRequest(object):
|
|||
# Return: <dict> Posted variables
|
||||
def getPosted(self):
|
||||
if self.env['REQUEST_METHOD'] == "POST":
|
||||
try:
|
||||
content_length = int(self.env.get('CONTENT_LENGTH', 0))
|
||||
except ValueError:
|
||||
content_length = 0
|
||||
return dict(urllib.parse.parse_qsl(
|
||||
self.env['wsgi.input'].readline().decode()
|
||||
self.env['wsgi.input'].read(content_length).decode()
|
||||
))
|
||||
else:
|
||||
return {}
|
||||
|
|
Loading…
Reference in a new issue