aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
Diffstat (limited to 'cgi')
-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()