]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Handle 1xx's along 204/304's
authorSebastien Boving <seb@google.com>
Wed, 5 Jul 2017 17:04:33 +0000 (10:04 -0700)
committerBen Darnell <ben@bendarnell.com>
Fri, 5 Jan 2018 03:10:37 +0000 (22:10 -0500)
tornado/web.py

index 338fe0f050beeebdf1941c2b547d00c8737d7b54..e8d102b50e9880ff665591faba0a9887d19e3630 100644 (file)
@@ -974,11 +974,11 @@ class RequestHandler(object):
                 if self.check_etag_header():
                     self._write_buffer = []
                     self.set_status(304)
-            if self._status_code in (204, 304):
+            if (self._status_code in (204, 304) or
+                (self._status_code >= 100 and self._status_code < 200)):
                 assert not self._write_buffer, "Cannot send body with %s" % self._status_code
                 self._clear_headers_for_304()
-            elif ("Content-Length" not in self._headers and
-                  (self._status_code < 100 or self._status_code >= 200)):
+            elif "Content-Length" not in self._headers:
                 content_length = sum(len(part) for part in self._write_buffer)
                 self.set_header("Content-Length", content_length)