🐛 Fix double response on POST/PUT/etc
Not setting the _finished flag to True caused the UploadStorage- FallbackHandler to generate an additional empty text/html response for every POST/PUT/etc request. If that arrived inside a keep-alive connection followed by additional requests, it caused the browser to consider the text/html response to be the response to the follow-up request, causing all kinds of mayhem.
This commit is contained in:
1 parent
172b962673
commit
474c792233
1 file changed
+6
-3
@@ -311,6 +311,7 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin, CorsSupport
|
||||
else:
|
||||
self._fallback(self.request, b"")
|
||||
self._finished = True
|
||||
self.on_finish()
|
||||
|
||||
def data_received(self, chunk):
|
||||
"""
|
||||
@@ -591,10 +592,12 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin, CorsSupport
|
||||
result = self._fallback(self.request, body)
|
||||
if result is not None:
|
||||
await result
|
||||
# self._headers_written = True
|
||||
finally:
|
||||
# make sure the temporary files are removed again
|
||||
self._cleanup_files()
|
||||
self._finished = True
|
||||
self.on_finish()
|
||||
|
||||
def on_finish(self):
|
||||
self._cleanup_files()
|
||||
|
||||
def _cleanup_files(self):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user