basecamp / pow

Zero-configuration Rack server for Mac OS X
http://pow.cx/
MIT License
3.41k stars 259 forks source link

Sendfile Range request #539

Open khoan opened 7 years ago

khoan commented 7 years ago

Fail to play video with pow due to range request not processed correctly as mentioned here http://stackoverflow.com/questions/16450616/what-is-the-proper-way-to-serve-mp4-files-through-rails-to-an-ipad#answer-16593030

$ cat config.ru
use Rack::Sendfile, 'X-Sendfile'
class Bam
  def to_path
    '/path/to/video.mp4'
  end
end
run Proc.new {|env| [200, {}, Bam.new]}

# 200 instead of 206
# whole file is served
$ curl --range 0-2 -i http://pow.dev/ -o /dev/null

However, files in public/ folder responds to Range request correctly.

$ ls public
video.mp4
# 206
# partial file is served
$ curl --range 0-2 -i http://pow.dev/video.mp4 -o /dev/null

Workaround is to use Rack::File instead of Rack::Sendfile.

speedmax commented 7 years ago

+1