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