honor bandwidth limit while sending previews

This commit is contained in:
j 2016-02-24 10:58:33 +05:30
parent 5a5b5baf7b
commit 7d27c4f3a1
1 changed files with 3 additions and 3 deletions

View File

@ -137,10 +137,10 @@ class Handler(http.server.SimpleHTTPRequestHandler):
self.send_response(404, 'Not Found')
self.send_header('Content-type', 'text/plain')
data = b'404 - Not Found'
self.send_header('Content-Length', str(len(data)))
content_length = len(data)
self.send_header('Content-Length', str(content_length))
self.end_headers()
# FIXME: also check for limit here
self.wfile.write(data)
self.write_with_limit(data, content_length)
return
file = item.models.File.get(id)
if not file: