]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Catch StreamClosedError in StaticFileHandler.
authorBen Darnell <ben@bendarnell.com>
Sun, 12 Oct 2014 02:05:31 +0000 (22:05 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 12 Oct 2014 02:05:31 +0000 (22:05 -0400)
Closes #1208.

tornado/web.py

index afc72facb888d9060e0fc3681106661d8267c8ad..a038265fd3fd4a726d8e1f2f993c79dc9e5ab1e7 100644 (file)
@@ -2172,8 +2172,11 @@ class StaticFileHandler(RequestHandler):
             if isinstance(content, bytes):
                 content = [content]
             for chunk in content:
-                self.write(chunk)
-                yield self.flush()
+                try:
+                    self.write(chunk)
+                    yield self.flush()
+                except iostream.StreamClosedError:
+                    return
         else:
             assert self.request.method == "HEAD"