end is size-1

This commit is contained in:
j 2017-05-30 21:03:14 +02:00
parent 56477d2757
commit 66989a78e5

View file

@ -66,7 +66,7 @@ def serve_static(handler, path, mimetype, include_body=True, disposition=None):
handler.set_status(206) handler.set_status(206)
r = handler.request.headers.get('Range').split('=')[-1].split('-') r = handler.request.headers.get('Range').split('=')[-1].split('-')
start = int(r[0]) start = int(r[0])
end = int(r[1]) if r[1] else size end = int(r[1]) if r[1] else (size - 1)
length = end - start + 1 length = end - start + 1
handler.set_header('Content-Length', str(length)) handler.set_header('Content-Length', str(length))
handler.set_header('Content-Range', 'bytes %s-%s/%s' % (start, end, size)) handler.set_header('Content-Range', 'bytes %s-%s/%s' % (start, end, size))