Fix sendfile behaviour for open files with non-zero offset.

This commit is contained in:
Vytautas Liuolia 2021-11-12 21:39:10 +01:00
parent ff58e0c6da
commit f639128bd7

View File

@ -372,7 +372,7 @@ class Response(object):
chunk_size = "%X\r\n" % nbytes chunk_size = "%X\r\n" % nbytes
self.sock.sendall(chunk_size.encode('utf-8')) self.sock.sendall(chunk_size.encode('utf-8'))
self.sock.sendfile(respiter.filelike, count=nbytes) self.sock.sendfile(respiter.filelike, offset=offset, count=nbytes)
if self.is_chunked(): if self.is_chunked():
self.sock.sendall(b"\r\n") self.sock.sendall(b"\r\n")