开发者

Resuming file downloads in Ruby on Rails (Range: header support)

I am trying to make my Rails app support resuming of downloads, since we serve quite large files from there. I found a piece of middleware to do this long ago, but I cant find it again. Any tips/tricks on how to pull it off?

Thanks开发者_开发问答! :)


This was how I did it:

response.header["Accept-Ranges"] = "bytes"
send_file product.pack.path, :type => product.pack_content_type, :x_sendfile=>true

I asked our server guy to set up mod_xsendfile, I don't know how to set it myself.

Tutorial here: http://www.devsource.com/c/a/Techniques/Resumable-File-Downloads-with-ASPNet/2/

Read about content-length here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13

About streaming is available here: http://api.rubyonrails.org/classes/ActionController/Streaming.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜