From: Sebastien Boving Date: Wed, 5 Jul 2017 17:04:33 +0000 (-0700) Subject: Handle 1xx's along 204/304's X-Git-Tag: v5.0.0~66^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee76ed4d0e0ab23c56a8503e88a7a181a78ffcce;p=thirdparty%2Ftornado.git Handle 1xx's along 204/304's --- diff --git a/tornado/web.py b/tornado/web.py index c86d9838d..defd21618 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -994,11 +994,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)