Skip to content

Commit

Permalink
Merge branch 'multipart/form-data' of github.com:jehiah/tornado into …
Browse files Browse the repository at this point in the history
…multipart/form-data
  • Loading branch information
jehiah committed May 17, 2010
2 parents af08ab0 + 692456b commit 18cb45c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tornado/wsgi.py
Expand Up @@ -125,8 +125,8 @@ def __init__(self, environ):
if content_type.startswith("application/x-www-form-urlencoded"):
for name, values in cgi.parse_qs(self.body).iteritems():
self.arguments.setdefault(name, []).extend(values)
elif content_type.startswith("multipart/form-data"):
boundary = content_type[30:]
elif content_type.startswith("multipart/form-data") and '=' in content_type:
boundary = content_type.split('=',1)[1]
if boundary: self._parse_mime_body(boundary)

self._start_time = time.time()
Expand All @@ -148,6 +148,8 @@ def request_time(self):
return self._finish_time - self._start_time

def _parse_mime_body(self, boundary):
if boundary.startswith('"'):
boundary = boundary.strip('"')
if self.body.endswith("\r\n"):
footer_length = len(boundary) + 6
else:
Expand Down

0 comments on commit 18cb45c

Please sign in to comment.