honor bandwidth limit while sending previews

This commit is contained in:
j 2016-02-24 10:58:33 +05:30
parent 5a5b5baf7b
commit 7d27c4f3a1

View file

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