Merge pull request #2687 from vytas7/fix-sendfile-offset

Fix sendfile behaviour for open files with non-zero offset
This commit is contained in:
Benoit Chesneau 2022-10-15 21:02:35 +02:00 committed by GitHub
commit 00de6d9d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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