aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar bai 2019-04-03 14:50:42 +0000
committerLibravatar bai 2019-04-03 14:50:42 +0000
commit6faf8a6c2c297df5bc4d7a03f93a6cb600ea584f (patch)
treeb676cae6c702b1ba6ea8808cad5b3d17cdd0e024
parent0640ed8aa7ba0aaef5c74e2ce6b889796e171cc7 (diff)
downloadweabot-6faf8a6c2c297df5bc4d7a03f93a6cb600ea584f.tar.gz
weabot-6faf8a6c2c297df5bc4d7a03f93a6cb600ea584f.tar.xz
weabot-6faf8a6c2c297df5bc4d7a03f93a6cb600ea584f.zip
Manejando rawpost en framework.py
-rw-r--r--cgi/framework.py6
-rwxr-xr-xcgi/weabot.py5
2 files changed, 5 insertions, 6 deletions
diff --git a/cgi/framework.py b/cgi/framework.py
index 4a9a6e2..5f4f4f4 100644
--- a/cgi/framework.py
+++ b/cgi/framework.py
@@ -220,13 +220,15 @@ def getFormData(self):
Process input sent to WSGI through a POST method and output it in an easy to
retrieve format: dictionary of dictionaries in the format of {key: value}
"""
+ # This must be done to avoid a bug in cgi.FieldStorage
+ self.environ.setdefault("QUERY_STRING", "")
+ if self.environ["QUERY_STRING"] == "rawpost":
+ return None
wsgi_input = self.environ["wsgi.input"]
post_form = self.environ.get("wsgi.post_form")
if (post_form is not None
and post_form[0] is wsgi_input):
return post_form[2]
- # This must be done to avoid a bug in cgi.FieldStorage
- self.environ.setdefault("QUERY_STRING", "")
fs = cgi.FieldStorage(fp=wsgi_input,
environ=self.environ,
keep_blank_values=1)
diff --git a/cgi/weabot.py b/cgi/weabot.py
index f576f91..8d352a7 100755
--- a/cgi/weabot.py
+++ b/cgi/weabot.py
@@ -38,10 +38,7 @@ class weabot(object):
self.environ["PATH_INFO"] = self.environ["PATH_INFO"][11:]
self.start = start_response
-
- if self.environ.get("QUERY_STRING") != "rawpost":
- self.formdata = getFormData(self)
-
+ self.formdata = getFormData(self)
self.output = ""
self.handleRequest()