From a8bf673e61f470dca8d580a2fbc54de34c606c0f Mon Sep 17 00:00:00 2001 From: alex-eri Date: Thu, 9 Mar 2017 22:53:08 +0300 Subject: [PATCH] better fixes #1595 --- aiohttp/file_sender.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aiohttp/file_sender.py b/aiohttp/file_sender.py index e1708f778b4..34dbeb842dd 100644 --- a/aiohttp/file_sender.py +++ b/aiohttp/file_sender.py @@ -176,8 +176,6 @@ def send(self, request, filepath): # If a range request has been made, convert start, end slice notation # into file pointer offset and count if start is not None or end is not None: - if start > 0 or end: - status = HTTPPartialContent.status_code if start is None and end < 0: # return tail of file start = file_size + end count = -end @@ -194,6 +192,9 @@ def send(self, request, filepath): # the current length of the selected representation). count = file_size - start + if count != file_size: + status = HTTPPartialContent.status_code + resp = self._response_factory(status=status) resp.content_type = ct if encoding: