From 86c6cda79a378e805d76f1abc19b0f7410eb0f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 6 Aug 2014 16:21:32 +0200 Subject: [PATCH] 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 --- src/octoprint/server/util/tornado.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index 6837fbd5..5da04a79 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -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 = []