Code: Select all
self.chunk = 2048
with open(self.fdir+req['path'], 'rb') as html:
head = self.head(req['path'])
chunk = head + html.read(self.chunk - len(head))
while chunk:
res.sendall(chunk)
chunk = html.read(self.chunk)
res.close()