summaryrefslogtreecommitdiff
path: root/routes/middleware.py
diff options
context:
space:
mode:
authorbbangert <none@none>2007-04-26 12:05:16 -0700
committerbbangert <none@none>2007-04-26 12:05:16 -0700
commit3c8bd053f40cd6c560ea0f2d6c9d4f33feebcfb0 (patch)
tree103c7419ba4787e052b5aac76059a28413046eee /routes/middleware.py
parent37381fbc0b5d490155b8d7d9464e3214ff7b7890 (diff)
downloadroutes-3c8bd053f40cd6c560ea0f2d6c9d4f33feebcfb0.tar.gz
[svn] * Fixed Routes middleware to only parse POST's if the content type is
application/x-www-form-urlencoded for a HTML form. This properly avoids parsing wsgi.input when it doesn't need to be. --HG-- branch : trunk
Diffstat (limited to 'routes/middleware.py')
-rw-r--r--routes/middleware.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/routes/middleware.py b/routes/middleware.py
index cc5ac26..da32eb7 100644
--- a/routes/middleware.py
+++ b/routes/middleware.py
@@ -55,7 +55,9 @@ altering = %s""" % (use_method_override, path_info))
environ['REQUEST_METHOD'] = req.GET['_method'].upper()
log.debug("_method found in QUERY_STRING, altering request"
" method to %s" % environ['REQUEST_METHOD'])
- elif environ['REQUEST_METHOD'] == 'POST' and '_method' in req.POST:
+ elif environ['REQUEST_METHOD'] == 'POST' and \
+ 'application/x-www-form-urlencoded' in environ['CONTENT_TYPE'] \
+ and'_method' in req.POST:
old_method = environ['REQUEST_METHOD']
environ['REQUEST_METHOD'] = req.POST['_method'].upper()
log.debug("_method found in POST data, altering request "