Better fix for safari video bug

This seems to work everywhere that I've tested.
This commit is contained in:
Cris Ward 2017-09-28 12:07:26 +01:00 committed by GitHub
parent 81f2ee7815
commit 6c11f943d0

View file

@ -149,14 +149,14 @@ private def multipart(file, env : HTTP::Server::Context)
end
if endb == 0
endb = fileb
endb = fileb - 1
end
if startb < endb && endb <= fileb
env.response.status_code = 206
env.response.content_length = endb - startb
env.response.headers["Accept-Ranges"] = "bytes"
env.response.headers["Content-Range"] = "bytes #{startb}-#{endb > 1 ? endb - 1 : 1}/#{fileb}" # MUST
env.response.headers["Content-Range"] = "bytes #{startb}-#{endb}/#{fileb}" # MUST
if startb > 1024
skipped = 0