[Mongrel] problem when downloading files with xsendfile

Amit Tomar lists at ruby-forum.com
Mon Sep 27 08:51:40 EDT 2010


Hii All, i loaded mod_xsendfile.so in apche , i added few line in
httpd.conf files

LoadModule xsendfile_module modules/mod_xsendfile.so

XSendFile on

XSendFileAllowAbove on

<VirtualHost * localhost:80>
ServerName src

DocumentRoot C:/InstantRails-2.0-win/rails_apps/src/public/

ProxyPass / http://localhost:3000/

ProxyPassReverse / http://localhost:3000/

</VirtualHost >

now in my rails application i have a streams controller and inside
streams controller i have a function named download ,code for code
download is below

def download

@stream = Stream.find(params[:id])

filename = "#{@stream.location}"

response.headers['Content-Type'] = "application/force-download"

response.headers['Content-Disposition'] = "attachment;
filename=\"#{File.basename(filename)}\""

response.headers["X-Sendfile"] = @stream.location

response.headers['Content-length'] = File.size(filename)

render :nothing => true

end

Problem is my rails application still handling this request but i would
like apache to handle this request ,can anyone tell me how i configure
apche to handle this request??



Actully when i downloding files,mongrel rendering things,

Processing StreamsController#download (for 127.0.0.1 at 2010-09-27
16:50:47) [GET]
  Parameters: {"id"=>"6655"}
  ?[4;36;1mSQL (0.0ms)?[0m   ?[0;1mSET NAMES 'utf8'?[0m
  ?[4;35;1mSQL (0.0ms)?[0m   ?[0mSET SQL_AUTO_IS_NULL=0?[0m
  ?[4;36;1mStream Columns (0.0ms)?[0m   ?[0;1mSHOW FIELDS FROM
`streams`?[0m
  ?[4;35;1mStream Load (0.0ms)?[0m   ?[0mSELECT * FROM `streams` WHERE
(`streams`.`id` = 6655) ?[0
Completed in 78ms (View: 0, DB: 0) | 200 OK
[http://src/streams/download/6655]

It is when i am trying to download 2.2GB of file ,file is downloaded
completely,but my worry is why mongrel is rendering things if apache is
handling download
-- 
Posted via http://www.ruby-forum.com/.


More information about the Mongrel-users mailing list