]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Parse form bodies on PUT as well as POST.
authorBen Darnell <ben@bendarnell.com>
Wed, 4 Aug 2010 19:02:05 +0000 (12:02 -0700)
committerBen Darnell <ben@bendarnell.com>
Wed, 4 Aug 2010 19:02:05 +0000 (12:02 -0700)
HTML5 adds support for PUT and DELETE in forms, so x-www-form-urlencoded
PUT bodies are now possible.

tornado/httpserver.py

index 6cece5d7a8a3c7bfc01617f1c0794caace38daa9..8b6368f0b6a593313be09f4ace5f7c77f3874a99 100644 (file)
@@ -312,7 +312,7 @@ class HTTPConnection(object):
     def _on_request_body(self, data):
         self._request.body = data
         content_type = self._request.headers.get("Content-Type", "")
-        if self._request.method == "POST":
+        if self._request.method in ("POST", "PUT"):
             if content_type.startswith("application/x-www-form-urlencoded"):
                 arguments = cgi.parse_qs(self._request.body)
                 for name, values in arguments.iteritems():