Stop customized RequestHandler from sending another set of headers after the response

This was causing the GET request for the list of files following directly after a successful response from an upload to get associated with the second empty response sent directly after the upload and such lead to a funny timing issue causing the file list not to update correctly since the response to THAT request -- while received by the client -- could then not be processed.

See #455
This commit is contained in:
Gina Häußge 2014-08-06 16:21:32 +02:00
parent 488eb1fac3
commit 86c6cda79a

View file

@ -134,8 +134,6 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
body-less request, just calls the `fallback` with an empty body and finishes the request.
"""
if self.request.method in UploadStorageFallbackHandler.BODY_METHODS:
print("### In UploadStorageFallbackHandler.prepare, processing body: %r" % self.request)
self._bytes_left = self.request.headers.get("Content-Length", 0)
self._content_type = self.request.headers.get("Content-Type", None)
@ -158,8 +156,6 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
else:
self._multipart_boundary = None
else:
print("### In UploadStorageFallbackHandler.prepare, invoking fallback: %r" % self.request)
self._fallback(self.request, b"")
self._finished = True
@ -178,9 +174,6 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
else:
self._buffer = data
def on_finish(self):
pass
def is_multipart(self):
"""Checks whether this request is a `multipart` request"""
return self._content_type is not None and self._content_type.startswith("multipart")
@ -373,6 +366,7 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
try:
# call the configured fallback with request and body to use
self._fallback(self.request, body)
self._headers_written = True
finally:
# make sure the temporary files are removed again
for f in self._files:
@ -417,8 +411,6 @@ class WsgiInputContainer(object):
:param body: an optional body to use as `wsgi.input` instead of `request.body`, can be a string or a stream
"""
print("### In WsgiInputContainer.__call__: %r" % request)
data = {}
response = []