From 55ae667b48aaf1f888b3a0b38055eee4b94c9944 Mon Sep 17 00:00:00 2001 From: David Wolever Date: Tue, 21 May 2013 00:47:15 -0400 Subject: [PATCH] Only send Content-Range with HTTP 206 --- tornado/test/web_test.py | 2 +- tornado/web.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py index 65417f9a8..018004baf 100644 --- a/tornado/test/web_test.py +++ b/tornado/test/web_test.py @@ -896,7 +896,7 @@ class StaticFileTest(WebTestCase): with open(robots_file_path) as f: self.assertEqual(response.body, utf8(f.read())) self.assertEqual(response.headers.get("Content-Length"), "26") - self.assertEqual(response.headers.get("Content-Range"), "0-25/26") + self.assertEqual(response.headers.get("Content-Range"), None) def test_static_with_range_end_edge(self): response = self.fetch('/static/robots.txt', headers={ diff --git a/tornado/web.py b/tornado/web.py index bbf68d05c..1d5dea217 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1816,8 +1816,8 @@ class StaticFileHandler(RequestHandler): # ``Range: bytes=0-``. if size != (end or size) - (start or 0): self.set_status(206) # Partial Content - self.set_header("Content-Range", - httputil._get_content_range(start, end, size)) + self.set_header("Content-Range", + httputil._get_content_range(start, end, size)) else: start = end = None content = self.get_content(self.absolute_path, start, end) -- 2.47.2